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:
esaunders 2017-01-19 17:20:02 -05:00
parent fdf83c751e
commit 2217eb0f98

View File

@ -131,7 +131,7 @@ class QueryResults {
subProgress.progress(keywordList.getName() + ": " + hitDisplayStr, unitProgress);
}
for (KeywordHit hit : getOneHitPerObject(keyword)) {
for (KeywordHit hit : getResults(keyword)) {
String termString = keyword.getSearchTerm();
final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(termString);
String snippet;
@ -174,29 +174,6 @@ class QueryResults {
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
*