mirror of https://github.com/apache/lucene.git
LUCENE-8142: Fix AssertingImpactsEnum and add missing javadoc.
This commit is contained in:
parent
e00c4cede2
commit
46ecb73976
|
@ -23,6 +23,9 @@ import java.util.List;
|
|||
*/
|
||||
public abstract class Impacts {
|
||||
|
||||
/** Sole constructor. Typically invoked by sub classes. */
|
||||
protected Impacts() {}
|
||||
|
||||
/**
|
||||
* Return the number of levels on which we have impacts.
|
||||
* The returned value is always greater than 0 and may not always be the
|
||||
|
|
|
@ -53,6 +53,7 @@ final class DisjunctionMaxScorer extends DisjunctionScorer {
|
|||
float scoreMax = 0;
|
||||
double otherScoreSum = 0;
|
||||
for (Scorer scorer : subScorers) {
|
||||
scorer.advanceShallow(0);
|
||||
float subScore = scorer.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
|
||||
if (subScore >= scoreMax) {
|
||||
otherScoreSum += scoreMax;
|
||||
|
|
|
@ -36,6 +36,7 @@ final class DisjunctionSumScorer extends DisjunctionScorer {
|
|||
super(weight, subScorers, needsScores);
|
||||
double maxScore = 0;
|
||||
for (Scorer scorer : subScorers) {
|
||||
scorer.advanceShallow(0);
|
||||
maxScore += scorer.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
|
||||
}
|
||||
// The error of sums depends on the order in which values are summed up. In
|
||||
|
|
|
@ -76,6 +76,11 @@ class ReqExclScorer extends Scorer {
|
|||
return reqScorer.score(); // reqScorer may be null when next() or skipTo() already return false
|
||||
}
|
||||
|
||||
@Override
|
||||
public int advanceShallow(int target) throws IOException {
|
||||
return reqScorer.advanceShallow(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxScore(int upTo) throws IOException {
|
||||
return reqScorer.getMaxScore(upTo);
|
||||
|
|
|
@ -52,6 +52,7 @@ class ReqOptSumScorer extends Scorer {
|
|||
this.reqScorer = reqScorer;
|
||||
this.optScorer = optScorer;
|
||||
|
||||
reqScorer.advanceShallow(0);
|
||||
this.reqMaxScore = reqScorer.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
|
||||
this.maxScorePropagator = new MaxScoreSumPropagator(Arrays.asList(reqScorer, optScorer));
|
||||
|
||||
|
@ -209,6 +210,12 @@ class ReqOptSumScorer extends Scorer {
|
|||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int advanceShallow(int target) throws IOException {
|
||||
optScorer.advanceShallow(target);
|
||||
return reqScorer.advanceShallow(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxScore(int upTo) throws IOException {
|
||||
float maxScore = reqScorer.getMaxScore(upTo);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class AssertingScorer extends Scorer {
|
|||
IteratorState state = IteratorState.ITERATING;
|
||||
int doc;
|
||||
float minCompetitiveScore = 0;
|
||||
int lastShallowTarget;
|
||||
int lastShallowTarget = -1;
|
||||
|
||||
private AssertingScorer(Random random, Scorer in, ScoreMode scoreMode) {
|
||||
super(in.weight);
|
||||
|
|
Loading…
Reference in New Issue