gf2121 commented on code in PR #14523: URL: https://github.com/apache/lucene/pull/14523#discussion_r2051413753
########## lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java: ########## @@ -524,17 +524,21 @@ public int advance(int target) throws IOException { @Override public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) throws IOException { + upTo = Math.min(upTo, maxDoc); if (upTo <= doc) { return; } // Optimize the case when intersecting the competitive iterator is expensive, which is when it // hasn't nailed down a disjunction of competitive terms yet. if (disjunction == null) { if (docsWithField != null) { + // Paranoid check, we need to be absolutely sure that the iterator is at least at offset + if (docsWithField.docID() < offset) { Review Comment: +1 ########## lucene/core/src/java/org/apache/lucene/search/DisjunctionDISIApproximation.java: ########## @@ -146,6 +146,9 @@ public int advance(int target) throws IOException { @Override public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) throws IOException { while (leadTop.doc < upTo) { + if (leadTop.approximation.docID() < offset) { + leadTop.approximation.advance(offset); + } Review Comment: I think we did not need this because the caller of `DisjunctionDISIApproximation` should make sure `docID >= offset` before calling `intoBitset`. There should be no problem here like the competitiveIterator in `TermOldValComparator` where the doc is inconsistent with the inner structure. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org