Skip to content

Commit

Permalink
adding validation in depth
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Jain <[email protected]>
  • Loading branch information
vibrantvarun committed Oct 16, 2024
1 parent 58cd4c1 commit f1c64dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ public static CollectorManager createHybridCollectorManager(final SearchContext
final IndexReader reader = searchContext.searcher().getIndexReader();
final int totalNumDocs = Math.max(0, reader.numDocs());
HybridQuery hybridQuery = (HybridQuery) searchContext.query();
int numDocs = Math.min(hybridQuery.getPaginationDepth(), totalNumDocs);
int retrievalSize;
if (hybridQuery.getPaginationDepth() == 0) {
retrievalSize = searchContext.from() + searchContext.size();
} else {
retrievalSize = hybridQuery.getPaginationDepth();
}
int numDocs = Math.min(retrievalSize, totalNumDocs);
int trackTotalHitsUpTo = searchContext.trackTotalHitsUpTo();
if (searchContext.sort() != null) {
validateSortCriteria(searchContext, searchContext.trackScores());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,6 @@ protected boolean searchWithCollector(
hasTimeout
);
}

}
}

0 comments on commit f1c64dc

Please sign in to comment.