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;
|
||||
Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
||||
for (FsContent f : fsContents) {
|
||||
final Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
||||
final int numFsContents = fsContents.size();
|
||||
int cur = 0;
|
||||
for (final FsContent f : fsContents) {
|
||||
//get unique match result files
|
||||
Map<String, Object> resMap = new LinkedHashMap<String, Object>();
|
||||
AbstractFsContentNode.fillPropertyMap(resMap, f);
|
||||
@ -260,10 +262,18 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValue> {
|
||||
toPopulate.add(new KeyValueContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped));
|
||||
|
||||
//write to bb
|
||||
na.addAll(tcq.writeToBlackBoard(f));
|
||||
final boolean sendDataEvent = (cur == numFsContents-1?true:false);
|
||||
new Thread() {
|
||||
@Override
|
||||
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++;
|
||||
}
|
||||
//notify bb viewers
|
||||
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public class LuceneQuery implements KeywordSearchQuery {
|
||||
@Override
|
||||
public void execute() {
|
||||
escape();
|
||||
List<FsContent> matches = performQuery();
|
||||
final List<FsContent> matches = performQuery();
|
||||
|
||||
String pathText = "Keyword query: " + query;
|
||||
|
||||
@ -164,12 +164,17 @@ public class LuceneQuery implements KeywordSearchQuery {
|
||||
searchResultWin.requestActive(); // make it the active top component
|
||||
|
||||
//write to bb
|
||||
Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
||||
for (FsContent newHit : matches) {
|
||||
na.addAll(writeToBlackBoard(newHit));
|
||||
}
|
||||
//notify bb viewers
|
||||
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Collection<BlackboardArtifact> na = new ArrayList<BlackboardArtifact>();
|
||||
for (FsContent newHit : matches) {
|
||||
na.addAll(writeToBlackBoard(newHit));
|
||||
}
|
||||
//notify bb viewers
|
||||
IngestManager.fireServiceDataEvent(new ServiceDataEvent(KeywordSearchIngestService.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user