mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
LUCENE-10555: fix iteratorCost initial logic error (#878)
This commit is contained in:
parent
8476ac1f6a
commit
6c6bb00cec
@ -126,7 +126,6 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
|
|||||||
this.minValueAsBytes =
|
this.minValueAsBytes =
|
||||||
reverse ? new byte[bytesCount] : topValueSet ? new byte[bytesCount] : null;
|
reverse ? new byte[bytesCount] : topValueSet ? new byte[bytesCount] : null;
|
||||||
this.competitiveIterator = DocIdSetIterator.all(maxDoc);
|
this.competitiveIterator = DocIdSetIterator.all(maxDoc);
|
||||||
this.iteratorCost = maxDoc;
|
|
||||||
} else {
|
} else {
|
||||||
this.enableSkipping = false;
|
this.enableSkipping = false;
|
||||||
this.maxDoc = 0;
|
this.maxDoc = 0;
|
||||||
@ -165,9 +164,13 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScorer(Scorable scorer) throws IOException {
|
public void setScorer(Scorable scorer) throws IOException {
|
||||||
if (iteratorCost == -1 && scorer instanceof Scorer) {
|
if (iteratorCost == -1) {
|
||||||
|
if (scorer instanceof Scorer) {
|
||||||
iteratorCost =
|
iteratorCost =
|
||||||
((Scorer) scorer).iterator().cost(); // starting iterator cost is the scorer's cost
|
((Scorer) scorer).iterator().cost(); // starting iterator cost is the scorer's cost
|
||||||
|
} else {
|
||||||
|
iteratorCost = maxDoc;
|
||||||
|
}
|
||||||
updateCompetitiveIterator(); // update an iterator when we have a new segment
|
updateCompetitiveIterator(); // update an iterator when we have a new segment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user