Skip to content

Commit d6a4928

Browse files
committed
cleaned up rankdocsretrieverbuilder
1 parent 79a138a commit d6a4928

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

server/src/main/java/org/elasticsearch/search/retriever/RankDocsRetrieverBuilder.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ public void extractToSearchSourceBuilder(SearchSourceBuilder searchSourceBuilder
105105
// if we have aggregations we need to compute them based on all doc matches, not just the top hits
106106
// similarly, for profile and explain we re-run all parent queries to get all needed information
107107
RankDoc[] rankDocResults = rankDocs.get();
108-
// If minScore is applied, total hits should only count the docs >= minScore, even if track_total_hits is requested.
109-
boolean trackTotalHitsDespiteMinScore = (hasAggregations(searchSourceBuilder)
108+
float effectiveMinScore = this.minScore() != null ? this.minScore() : RankDocsQueryBuilder.DEFAULT_MIN_SCORE;
109+
110+
if (hasAggregations(searchSourceBuilder)
110111
|| isExplainRequest(searchSourceBuilder)
111112
|| isProfileRequest(searchSourceBuilder)
112-
|| shouldTrackTotalHits(searchSourceBuilder)) && (sourceHasMinScore() == false);
113-
114-
if (trackTotalHitsDespiteMinScore) {
113+
|| shouldTrackTotalHits(searchSourceBuilder)) {
115114
if (false == isExplainRequest(searchSourceBuilder)) {
116115
rankQuery = new RankDocsQueryBuilder(
117116
rankDocResults,
@@ -127,7 +126,6 @@ public void extractToSearchSourceBuilder(SearchSourceBuilder searchSourceBuilder
127126
}
128127
} else {
129128
// Pass minScore down to RankDocsQueryBuilder
130-
float effectiveMinScore = this.minScore() != null ? this.minScore() : RankDocsQueryBuilder.DEFAULT_MIN_SCORE;
131129
rankQuery = new RankDocsQueryBuilder(rankDocResults, null, false, effectiveMinScore);
132130
}
133131
rankQuery.queryName(retrieverName());

0 commit comments

Comments
 (0)