Skip to content

Commit

Permalink
Renamed method
Browse files Browse the repository at this point in the history
  • Loading branch information
fragosoluana committed Dec 2, 2024
1 parent 7fc4782 commit b560950
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public SearchResponse handle(IndexState indexState, SearchRequest searchRequest)

if (searchContext.getFetchTasks().getHitsLoggerFetchTask() != null) {
hits =
getHitsToLogFromOffset(
getHitsFromOffsetAndHitsToLog(
hits,
searchContext.getStartHit(),
searchContext.getTopHits(),
Expand Down Expand Up @@ -528,7 +528,8 @@ public static TopDocs getHitsFromOffset(TopDocs hits, int startHit, int topHits)
/**
* Given all the top documents, produce a slice of the documents starting from a start offset and
* going up to the query needed maximum hits. There may be more top docs than the hits limit, if
* top docs sampling facets are used. There may be extra hits for logging to be retrieved.
* top docs sampling facets are used. There may be more hits than top hits for logging to be
* retrieved.
*
* @param hits all hits
* @param startHit offset into top docs
Expand All @@ -537,7 +538,7 @@ public static TopDocs getHitsFromOffset(TopDocs hits, int startHit, int topHits)
* @return slice of hits starting at given offset, or empty slice if there are less than startHit
* docs
*/
public static TopDocs getHitsToLogFromOffset(
public static TopDocs getHitsFromOffsetAndHitsToLog(
TopDocs hits, int startHit, int topHits, int hitsToLog) {
int retrieveHits = Math.min(Math.max(topHits, hitsToLog), hits.scoreDocs.length);
startHit = Math.min(startHit, retrieveHits - hitsToLog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public HitsLoggerFetchTask(LoggingHits loggingHits) {
*/
@Override
public void processAllHits(SearchContext searchContext, List<SearchResponse.Hit.Builder> hits) {
// hits list can contain extra hits that don't need to be logged, otherwise, pass all hits that can be logged
// hits list can contain extra hits that don't need to be logged, otherwise, pass all hits that
// can be logged
if (searchContext.getHitsToLog() < hits.size()) {
hitsLogger.log(searchContext, hits.subList(0, searchContext.getHitsToLog()));
} else {
Expand Down

0 comments on commit b560950

Please sign in to comment.