mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 00:16:16 +00:00
keyword search: when done from GUI, use background thread to write results to BB not to block the GUI thread for huge queries
This commit is contained in:
parent
af4905a7dd
commit
c6ce9575cf
@ -247,8 +247,10 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValue> {
|
|||||||
|
|
||||||
|
|
||||||
int resID = 0;
|
int resID = 0;
|
||||||
Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
final Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
||||||
for (FsContent f : fsContents) {
|
final int numFsContents = fsContents.size();
|
||||||
|
int cur = 0;
|
||||||
|
for (final FsContent f : fsContents) {
|
||||||
//get unique match result files
|
//get unique match result files
|
||||||
Map<String, Object> resMap = new LinkedHashMap<String, Object>();
|
Map<String, Object> resMap = new LinkedHashMap<String, Object>();
|
||||||
AbstractFsContentNode.fillPropertyMap(resMap, f);
|
AbstractFsContentNode.fillPropertyMap(resMap, f);
|
||||||
@ -258,12 +260,20 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValue> {
|
|||||||
setCommonProperty(resMap, CommonPropertyTypes.CONTEXT, snippet);
|
setCommonProperty(resMap, CommonPropertyTypes.CONTEXT, snippet);
|
||||||
}
|
}
|
||||||
toPopulate.add(new KeyValueContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped));
|
toPopulate.add(new KeyValueContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped));
|
||||||
|
|
||||||
//write to bb
|
//write to bb
|
||||||
na.addAll(tcq.writeToBlackBoard(f));
|
final boolean sendDataEvent = (cur == numFsContents-1?true:false);
|
||||||
}
|
new Thread() {
|
||||||
//notify bb viewers
|
@Override
|
||||||
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
public void run() {
|
||||||
|
na.addAll(tcq.writeToBlackBoard(f));
|
||||||
|
if (sendDataEvent == true) {
|
||||||
|
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
cur++;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ public class LuceneQuery implements KeywordSearchQuery {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
escape();
|
escape();
|
||||||
List<FsContent> matches = performQuery();
|
final List<FsContent> matches = performQuery();
|
||||||
|
|
||||||
String pathText = "Keyword query: " + query;
|
String pathText = "Keyword query: " + query;
|
||||||
|
|
||||||
@ -162,14 +162,19 @@ public class LuceneQuery implements KeywordSearchQuery {
|
|||||||
|
|
||||||
TopComponent searchResultWin = DataResultTopComponent.createInstance("Keyword search", pathText, filteredRootNode, matches.size());
|
TopComponent searchResultWin = DataResultTopComponent.createInstance("Keyword search", pathText, filteredRootNode, matches.size());
|
||||||
searchResultWin.requestActive(); // make it the active top component
|
searchResultWin.requestActive(); // make it the active top component
|
||||||
|
|
||||||
//write to bb
|
//write to bb
|
||||||
Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
new Thread() {
|
||||||
for (FsContent newHit : matches) {
|
@Override
|
||||||
na.addAll(writeToBlackBoard(newHit));
|
public void run() {
|
||||||
}
|
Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
||||||
//notify bb viewers
|
for (FsContent newHit : matches) {
|
||||||
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
na.addAll(writeToBlackBoard(newHit));
|
||||||
|
}
|
||||||
|
//notify bb viewers
|
||||||
|
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user