apache / apache/lucene

BitSetConjunctionDISI iterators fall out of sync when lead doc >= minlength of bitsets [LUCENE-10674]

Open
#11,709 1 comment 0 reactions 0 assignees View on GitHub
affects-version:9.0 affects-version:9.1 affects-version:9.2 affects-version:9.3 legacy-jira-priority:Minor module:core/search type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

In [BitSetConjunctionDISI.doNext()](https://github.com/apache/lucene/blob/releases/lucene/9.3.0/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java#L283-L285) if the lead doc is greater than or equal to the length of any of the BitSets, NO_MORE_DOCS is returned. On subsequent calls to [BitSetConjunctionDISI.docId(),](https://github.com/apache/lucene/blob/releases/lucene/9.3.0/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java#L263) the lead's docID which is not exhausted will be returned. I think this could be fixed by calling lead.advance(NO_MORE_DOCS) before returning NO_MORE_DOCS in doNext.

 

Related issue: #10581

---
Migrated from [LUCENE-10674](https://issues.apache.org/jira/browse/LUCENE-10674) by Jack Mazanec, updated Aug 15 2022
Pull requests: https://github.com/apache/lucene/pull/1068

Contributor guide

Open the contributing guide

Research direction

Start with BitSetConjunctionDISI.doNext() and docId() in lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java, using the linked issue #10581 for context. Reproduce the case where the lead doc is greater than or equal to a BitSet length, then verify that subsequent docId() calls consistently report exhaustion. The issue body references pull request 1068, so check that work before proceeding.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.