Apache Lucene open-source search software
Advance doc instead of offset in competitive iterator (#14530)
Guo Fenga8b503fdf250
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex ede3df9321c..fd5002f1f22 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -107,7 +107,7 @@ Bug Fixes* GITHUB#14522: Fix DISIDocIdStream::count so that it does not try to count beyond max.(Chris Hegarty)-* GITHUB#14523: Correct TermOrdValComparator competitive iterator so that it forces sparse+* GITHUB#14523, GITHUB#14530: Correct TermOrdValComparator competitive iterator so that it forces sparsefield iteration to be at least scoring window baseline when doing intoBitSet. (Ben Trent, Adrien Grand)======================= Lucene 10.2.0 =======================diff --git a/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java b/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.javaindex 8683aee3c76..4f8cc8099bc 100644--- a/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java+++ b/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java@@ -533,8 +533,8 @@ public class TermOrdValComparator extends FieldComparator<BytesRef> {if (disjunction == null) {if (docsWithField != null) {// we need to be absolutely sure that the iterator is at least at offset- if (docsWithField.docID() < offset) {- docsWithField.advance(offset);+ if (docsWithField.docID() < doc) {+ docsWithField.advance(doc);}docsWithField.intoBitSet(upTo, bitSet, offset);doc = docsWithField.docID();