Skip to content

Commit

Permalink
Fix max score computation in BlockMaxConjunctionBulkScorer. (#13397)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jpountz committed May 21, 2024
1 parent f1398ce commit d333dee
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private float computeMaxScore(int windowMin, int windowMax) throws IOException {
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;
Expand All @@ -76,7 +76,7 @@ private float computeMaxScore(int windowMin, int windowMax) throws IOException {
for (int i = sumOfOtherClauses.length - 2; i >= 0; --i) {
sumOfOtherClauses[i] += sumOfOtherClauses[i + 1];
}
return maxWindowScore;
return (float) maxWindowScore;
}

@Override
Expand Down

0 comments on commit d333dee

Please sign in to comment.