Fix max score computation in BlockMaxConjunctionBulkScorer. (#13397)

It sums up max scores in a float when it should sum them up in a double like we
do for `Scorer#score()`. Otherwise, max scores may be returned that are less
than actual scores.

This bug was introduced in #13343, so it is not released yet.

Closes #13371
Closes #13396
This commit is contained in:
Adrien Grand 2024-05-21 11:51:59 +02:00 committed by GitHub
parent da6bd22fd9
commit 5b1a34bddd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ final class BlockMaxConjunctionBulkScorer extends BulkScorer {
scorers[i].advanceShallow(windowMin);
}
float maxWindowScore = 0;
double maxWindowScore = 0;
for (int i = 0; i < scorers.length; ++i) {
float maxClauseScore = scorers[i].getMaxScore(windowMax);
sumOfOtherClauses[i] = maxClauseScore;
@ -76,7 +76,7 @@ final class BlockMaxConjunctionBulkScorer extends BulkScorer {
for (int i = sumOfOtherClauses.length - 2; i >= 0; --i) {
sumOfOtherClauses[i] += sumOfOtherClauses[i + 1];
}
return maxWindowScore;
return (float) maxWindowScore;
}
@Override