mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
fix a problem where max_score was NaN if there were no hits from a shard (though there are hits from other shards), it will still be NaN where there are no hits
This commit is contained in:
parent
cf998e2f89
commit
3006183191
@ -190,7 +190,12 @@ public class SearchPhaseController {
|
|||||||
float maxScore = Float.NEGATIVE_INFINITY;
|
float maxScore = Float.NEGATIVE_INFINITY;
|
||||||
for (QuerySearchResultProvider queryResultProvider : queryResults.values()) {
|
for (QuerySearchResultProvider queryResultProvider : queryResults.values()) {
|
||||||
totalHits += queryResultProvider.queryResult().topDocs().totalHits;
|
totalHits += queryResultProvider.queryResult().topDocs().totalHits;
|
||||||
maxScore = Math.max(maxScore, queryResultProvider.queryResult().topDocs().getMaxScore());
|
if (!Float.isNaN(queryResultProvider.queryResult().topDocs().getMaxScore())) {
|
||||||
|
maxScore = Math.max(maxScore, queryResultProvider.queryResult().topDocs().getMaxScore());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Float.isInfinite(maxScore)) {
|
||||||
|
maxScore = Float.NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean the fetch counter
|
// clean the fetch counter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user