From 2217eb0f98bf49b19a0afdb62d20af85fc5dfaec Mon Sep 17 00:00:00 2001 From: esaunders Date: Thu, 19 Jan 2017 17:20:02 -0500 Subject: [PATCH] Removed getOneHitPerObject() since Searcher.filterResults() guarantees that we will get a single hit per object (for the lowest numbered chunk). --- .../autopsy/keywordsearch/QueryResults.java | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java index 316e4f3717..c5741753df 100755 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java @@ -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 containing KeywordHits with lowest - * SolrObjectID-ChunkID pairs. - */ - private Collection getOneHitPerObject(Keyword keyword) { - - HashMap 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 *