This commit is contained in:
Tim McIver 2013-01-03 15:17:14 -05:00
commit c03c2f40fd
7 changed files with 57 additions and 13 deletions

View File

@ -505,6 +505,8 @@
--> -->
<field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="id" type="string" indexed="true" stored="true" required="true" />
<!-- use image_id to easily search a specific image only -->
<field name="image_id" type="string" indexed="true" stored="true" required="true" />
<!-- The content field holds the text extracted by SolrCell --> <!-- The content field holds the text extracted by SolrCell -->
<field name="content" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" /> <field name="content" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
<!-- The strings field holds strings extracted from files that SolrCell doesn't support --> <!-- The strings field holds strings extracted from files that SolrCell doesn't support -->

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.keywordsearch; package org.sleuthkit.autopsy.keywordsearch;
import java.awt.ComponentOrientation; import java.awt.ComponentOrientation;
import java.awt.EventQueue;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -610,6 +611,26 @@ class ExtractedContentPanel extends javax.swing.JPanel {
} }
} }
/**
* Scroll to current (first) hit after SetMarkup worker completed
*
* @param source
*/
private void scrollToCurrentHit(final MarkupSource source) {
if (source == null || !source.isSearchable()) {
return;
}
//scrolling required invokeLater to enqueue in EDT
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem()));
}
});
}
/** /**
* Gets and sets new markup. Updates GUI in GUI thread and gets markup in * Gets and sets new markup. Updates GUI in GUI thread and gets markup in
* background thread. To be invoked from GUI thread only. * background thread. To be invoked from GUI thread only.
@ -656,6 +677,9 @@ class ExtractedContentPanel extends javax.swing.JPanel {
} }
updateControls(source); updateControls(source);
scrollToCurrentHit(source);
} }
} }
} }

View File

@ -234,13 +234,10 @@ public class ExtractedContentViewer implements DataContentViewer {
if (currentPage == 0 && currentSource.hasNextPage()) { if (currentPage == 0 && currentSource.hasNextPage()) {
currentSource.nextPage(); currentSource.nextPage();
} }
updatePageControls(); updatePageControls();
// first source will be the default displayed // first source will be the default displayed
setPanel(sources); setPanel(sources);
// If node has been selected before, return to the previous position
scrollToCurrentHit();
} }
private void scrollToCurrentHit() { private void scrollToCurrentHit() {
@ -249,13 +246,8 @@ public class ExtractedContentViewer implements DataContentViewer {
return; return;
} }
// using invokeLater to wait for ComboBox selection to complete
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
panel.scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem())); panel.scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem()));
}
});
} }
@Override @Override

View File

@ -54,6 +54,7 @@ import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.FsContent; import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.LayoutFile; import org.sleuthkit.datamodel.LayoutFile;
import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Handles indexing files on a Solr core. * Handles indexing files on a Solr core.
@ -217,6 +218,12 @@ public class Ingester {
private Map<String, String> getCommonFields(AbstractFile af) { private Map<String, String> getCommonFields(AbstractFile af) {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put(Server.Schema.ID.toString(), Long.toString(af.getId())); params.put(Server.Schema.ID.toString(), Long.toString(af.getId()));
try {
params.put(Server.Schema.IMAGE_ID.toString(), Long.toString(af.getImage().getId()));
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Could not get image id to properly index the file " + af.getId());
}
params.put(Server.Schema.FILE_NAME.toString(), af.getName()); params.put(Server.Schema.FILE_NAME.toString(), af.getName());
return params; return params;
} }
@ -239,6 +246,14 @@ public class Ingester {
* @throws org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException * @throws org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException
*/ */
private void ingest(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException { private void ingest(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException {
if (fields.get(Server.Schema.IMAGE_ID.toString()) == null) {
//skip the file, image id unknown
String msg = "Skipping indexing the file, unknown image id, for file: " + cs.getName();
logger.log(Level.SEVERE, msg);
throw new IngesterException(msg);
}
SolrInputDocument updateDoc = new SolrInputDocument(); SolrInputDocument updateDoc = new SolrInputDocument();
for (String key : fields.keySet()) { for (String key : fields.keySet()) {

View File

@ -69,6 +69,12 @@ public class Server {
return "id"; return "id";
} }
}, },
IMAGE_ID {
@Override
public String toString() {
return "image_id";
}
},
CONTENT { CONTENT {
@Override @Override
public String toString() { public String toString() {

View File

@ -4,7 +4,7 @@ New features:
Improvements: Improvements:
- Keyword search indexing and search speed improvements - Keyword search indexing and search speed improvements
- Improved keyword search highlighting in Text View: highlighted tokens are no longer white-space separated - Improved keyword search highlighting in Text View: highlighted tokens are no longer delimiter separated
- Remake of reporting UI and functionality - Remake of reporting UI and functionality
- Significant increase in reporting speed - Significant increase in reporting speed
- Documented report module API - Documented report module API
@ -12,7 +12,8 @@ Improvements:
Bugfixes: Bugfixes:
- Keyword search will index and search entire extracted content from files - Keyword search now indexes and searches entire extracted content from files
- Fix scrolling to first keyword hit when Text View is first loaded
---------------- VERSION 3.0.2 -------------- ---------------- VERSION 3.0.2 --------------

View File

@ -104,8 +104,10 @@ public class ThunderbirdMboxFileIngestModule implements IngestModuleAbstractFile
byte[] t = new byte[64]; byte[] t = new byte[64];
if(fsContent.getSize() > 64) { if(fsContent.getSize() > 64) {
int byteRead = fsContent.read(t, 0, 64); int byteRead = fsContent.read(t, 0, 64);
if (byteRead > 0) {
isMbox = mbox.isValidMimeTypeMbox(t); isMbox = mbox.isValidMimeTypeMbox(t);
} }
}
} catch (TskException ex) { } catch (TskException ex) {
logger.log(Level.WARNING, null, ex); logger.log(Level.WARNING, null, ex);
} }
@ -120,6 +122,8 @@ public class ThunderbirdMboxFileIngestModule implements IngestModuleAbstractFile
Long msfId = 0L; Long msfId = 0L;
currentCase = Case.getCurrentCase(); // get the most updated case currentCase = Case.getCurrentCase(); // get the most updated case
SleuthkitCase tskCase = currentCase.getSleuthkitCase(); SleuthkitCase tskCase = currentCase.getSleuthkitCase();
try { try {
ResultSet resultset = tskCase.runQuery("SELECT obj_id FROM tsk_files WHERE parent_path = '" + mboxPath + "' and name = '" + msfName + "'"); ResultSet resultset = tskCase.runQuery("SELECT obj_id FROM tsk_files WHERE parent_path = '" + mboxPath + "' and name = '" + msfName + "'");
if (! resultset.next()) { if (! resultset.next()) {