Changed createKeys methods to add all keys at once instead of one at a time.

This commit is contained in:
Jeff Wallace 2013-10-18 14:11:22 -04:00
parent 2db89fe5f3
commit 15c6ed57cf

View File

@ -242,6 +242,8 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
return false; return false;
} }
List<KeyValueQuery> tempList = new ArrayList<>();
//execute the query and get fscontents matching //execute the query and get fscontents matching
Map<String, List<ContentHit>> tcqRes; Map<String, List<ContentHit>> tcqRes;
try { try {
@ -311,8 +313,13 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
} }
final String highlightQueryEscaped = getHighlightQuery(tcq, literal_query, tcqRes, f); final String highlightQueryEscaped = getHighlightQuery(tcq, literal_query, tcqRes, f);
toPopulate.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped, tcq, previewChunk, tcqRes)); tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped, tcq, previewChunk, tcqRes));
} }
// Add all the nodes to toPopulate at once. Minimizes node creation
// EDT threads, which can slow and/or hang the UI on large queries.
toPopulate.addAll(tempList);
//write to bb //write to bb
//cannot reuse snippet in ResultWriter //cannot reuse snippet in ResultWriter
//because for regex searches in UI we compress results by showing a file per regex once (even if multiple term hits) //because for regex searches in UI we compress results by showing a file per regex once (even if multiple term hits)
@ -449,15 +456,22 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
int resID = 0; int resID = 0;
final KeywordSearchQuery origQuery = thing.getQuery(); final KeywordSearchQuery origQuery = thing.getQuery();
List<KeyValueQuery> tempList = new ArrayList<>();
for (final AbstractFile f : uniqueMatches.keySet()) { for (final AbstractFile f : uniqueMatches.keySet()) {
final int previewChunkId = uniqueMatches.get(f); final int previewChunkId = uniqueMatches.get(f);
Map<String, Object> resMap = new LinkedHashMap<>(); Map<String, Object> resMap = new LinkedHashMap<>();
if (f.getType() == TSK_DB_FILES_TYPE_ENUM.FS) { if (f.getType() == TSK_DB_FILES_TYPE_ENUM.FS) {
AbstractFsContentNode.fillPropertyMap(resMap, (FsContent) f); AbstractFsContentNode.fillPropertyMap(resMap, (FsContent) f);
} }
toPopulate.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, keywordQuery, thing.getQuery(), previewChunkId, matchesRes)); tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, keywordQuery, thing.getQuery(), previewChunkId, matchesRes));
} }
// Add all the nodes to toPopulate at once. Minimizes node creation
// EDT threads, which can slow and/or hang the UI on large queries.
toPopulate.addAll(tempList);
//write to bb //write to bb
new ResultWriter(matchesRes, origQuery, "").execute(); new ResultWriter(matchesRes, origQuery, "").execute();