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 2022/05/11 06:36:31 UTC
[lucene] branch main updated: LUCENE-10555: fix iteratorCost initial logic error (#878)
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 6c6bb00cec8 LUCENE-10555: fix iteratorCost initial logic error (#878)
6c6bb00cec8 is described below
commit 6c6bb00cec84de04b405f230beeb8691a59a2be0
Author: xiaoping <wj...@gmail.com>
AuthorDate: Wed May 11 14:36:24 2022 +0800
LUCENE-10555: fix iteratorCost initial logic error (#878)
---
.../apache/lucene/search/comparators/NumericComparator.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java b/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java
index ddbf9a1d4ad..1e7bebb9dca 100644
--- a/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java
@@ -126,7 +126,6 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
this.minValueAsBytes =
reverse ? new byte[bytesCount] : topValueSet ? new byte[bytesCount] : null;
this.competitiveIterator = DocIdSetIterator.all(maxDoc);
- this.iteratorCost = maxDoc;
} else {
this.enableSkipping = false;
this.maxDoc = 0;
@@ -165,9 +164,13 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
@Override
public void setScorer(Scorable scorer) throws IOException {
- if (iteratorCost == -1 && scorer instanceof Scorer) {
- iteratorCost =
- ((Scorer) scorer).iterator().cost(); // starting iterator cost is the scorer's cost
+ if (iteratorCost == -1) {
+ if (scorer instanceof Scorer) {
+ iteratorCost =
+ ((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
}
}