mirror of https://github.com/apache/lucene.git
LUCENE-10555: avoid NumericLeafComparator#iteratorCost repeated initialization when NumericLeafComparator#setScorer is called (#864)
This commit is contained in:
parent
3edfeb5eb2
commit
f431511cb7
|
@ -118,6 +118,9 @@ Improvements
|
|||
Optimizations
|
||||
---------------------
|
||||
|
||||
* LUCENE-10555: avoid NumericLeafComparator#iteratorCost repeated initialization
|
||||
when NumericLeafComparator#setScorer is called. (Jianping Weng)
|
||||
|
||||
* LUCENE-10452: Hunspell: call checkCanceled less frequently to reduce the overhead (Peter Gromov)
|
||||
|
||||
* LUCENE-10451: Hunspell: don't perform potentially expensive spellchecking after timeout (Peter Gromov)
|
||||
|
|
|
@ -91,7 +91,7 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
|
|||
private final byte[] maxValueAsBytes;
|
||||
|
||||
private DocIdSetIterator competitiveIterator;
|
||||
private long iteratorCost;
|
||||
private long iteratorCost = -1;
|
||||
private int maxDocVisited = -1;
|
||||
private int updateCounter = 0;
|
||||
|
||||
|
@ -165,7 +165,7 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
|
|||
|
||||
@Override
|
||||
public void setScorer(Scorable scorer) throws IOException {
|
||||
if (scorer instanceof Scorer) {
|
||||
if (iteratorCost == -1 && scorer instanceof Scorer) {
|
||||
iteratorCost =
|
||||
((Scorer) scorer).iterator().cost(); // starting iterator cost is the scorer's cost
|
||||
updateCompetitiveIterator(); // update an iterator when we have a new segment
|
||||
|
|
Loading…
Reference in New Issue