You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2024/05/21 09:56:46 UTC
(lucene) branch branch_9x updated: Fix max score computation in BlockMaxConjunctionBulkScorer. (#13397)
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new d333deeb887 Fix max score computation in BlockMaxConjunctionBulkScorer. (#13397)
d333deeb887 is described below
commit d333deeb887ae63c73d4fe9dce775a8b5115b7d4
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Tue May 21 11:51:59 2024 +0200
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
---
.../java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java
index 31046cee5e8..ee7fada19e9 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java
@@ -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