mirror of https://github.com/apache/lucene.git
Scorer should sum up scores into a double (#12682)
### Description Addresses #12675 . Along with `MultiSimilarity.MultiSimScorer` found some others candidate scorer implementations for this fix.
This commit is contained in:
parent
6677109ee6
commit
5461d1a160
|
@ -236,6 +236,8 @@ Bug Fixes
|
|||
|
||||
* GITHUB#12642: Ensure #finish only gets called once on the base collector during drill-sideways (Greg Miller)
|
||||
|
||||
* GITHUB#12682: Scorer should sum up scores into a double. (Shubham Chaudhary)
|
||||
|
||||
Build
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -62,11 +62,11 @@ public class MultiSimilarity extends Similarity {
|
|||
|
||||
@Override
|
||||
public float score(float freq, long norm) {
|
||||
float sum = 0.0f;
|
||||
double sum = 0d;
|
||||
for (SimScorer subScorer : subScorers) {
|
||||
sum += subScorer.score(freq, norm);
|
||||
}
|
||||
return sum;
|
||||
return (float) sum;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -112,7 +112,7 @@ public class PassageScorer {
|
|||
}
|
||||
|
||||
public float score(Passage passage, int contentLength) {
|
||||
float score = 0;
|
||||
double score = 0d;
|
||||
BytesRefHash termsHash = new BytesRefHash();
|
||||
int hitCount = passage.getNumMatches();
|
||||
int[] termFreqsInPassage = new int[hitCount]; // maximum size
|
||||
|
@ -134,6 +134,6 @@ public class PassageScorer {
|
|||
tf(termFreqsInPassage[i], passage.getLength()) * weight(contentLength, termFreqsInDoc[i]);
|
||||
}
|
||||
score *= norm(passage.getStartOffset());
|
||||
return score;
|
||||
return (float) score;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue