Skip to content

Commit

Permalink
Fixed total num. hits in search results.
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorRodchenkov committed Jun 23, 2024
1 parent 3489571 commit 75b491d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/cpath/service/IndexImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private SearchResponse transform(Query query, IndexSearcher searcher, TopDocs to
}
SearchResponse response = new SearchResponse();
response.setMaxHitsPerPage(getMaxHitsPerPage());
long numTotalHits = topDocs.totalHits.value; //todo: call searcher.count(q) instead or it's the same?
long numTotalHits = searcher.count(query);
response.setNumHits(numTotalHits);
List<SearchHit> hits = response.getSearchHit();//empty list to be filled from top docs
assert hits!=null && hits.isEmpty();
Expand Down

0 comments on commit 75b491d

Please sign in to comment.