benwtrent commented on code in PR #14523:
URL: https://github.com/apache/lucene/pull/14523#discussion_r2051473858
##########
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:
This is the bug fix, the lazy setting of `docsWithField` was the cause.
Thank you for the test case @jpountz :D.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]