mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Removed getOneHitPerObject() since Searcher.filterResults() guarantees that we will get a single hit per object (for the lowest numbered chunk).
This commit is contained in:
parent
fdf83c751e
commit
2217eb0f98
@ -131,7 +131,7 @@ class QueryResults {
|
|||||||
subProgress.progress(keywordList.getName() + ": " + hitDisplayStr, unitProgress);
|
subProgress.progress(keywordList.getName() + ": " + hitDisplayStr, unitProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (KeywordHit hit : getOneHitPerObject(keyword)) {
|
for (KeywordHit hit : getResults(keyword)) {
|
||||||
String termString = keyword.getSearchTerm();
|
String termString = keyword.getSearchTerm();
|
||||||
final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(termString);
|
final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(termString);
|
||||||
String snippet;
|
String snippet;
|
||||||
@ -174,29 +174,6 @@ class QueryResults {
|
|||||||
return newArtifacts;
|
return newArtifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the first hit of the keyword.
|
|
||||||
*
|
|
||||||
* @param keyword
|
|
||||||
*
|
|
||||||
* @return Collection<KeywordHit> containing KeywordHits with lowest
|
|
||||||
* SolrObjectID-ChunkID pairs.
|
|
||||||
*/
|
|
||||||
private Collection<KeywordHit> getOneHitPerObject(Keyword keyword) {
|
|
||||||
|
|
||||||
HashMap<Long, KeywordHit> hits = new HashMap<>();
|
|
||||||
|
|
||||||
// create a list of KeywordHits. KeywordHits with lowest chunkID is added the the list.
|
|
||||||
for (KeywordHit hit : getResults(keyword)) {
|
|
||||||
if (!hits.containsKey(hit.getSolrObjectId())) {
|
|
||||||
hits.put(hit.getSolrObjectId(), hit);
|
|
||||||
} else if (hit.getChunkId() < hits.get(hit.getSolrObjectId()).getChunkId()) {
|
|
||||||
hits.put(hit.getSolrObjectId(), hit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hits.values();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an ingest inbox message for given keyword in given file
|
* Generate an ingest inbox message for given keyword in given file
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user