Should DocIdSetIterator#docID be final?
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
`DocIdSetIterator#docID` is always a simple getter, but because we allow many different implementations, it almost always requires a virtual call in practice, which makes it not so cheap.
We could instead have a protected `DocIdSetIterator#docID` field, make `DocIdSetIterator#docID()` return it, and update the contract of `nextDoc()` and `advance(int)` to require updating this `docID` field. Most implementations already do this, it would mostly be a change for wrappers (including `ConjunctionDISI`), which would need to copy the current doc ID of the wrapped iterator to their `docID` field.
Contributor guide
Research direction
Start with DocIdSetIterator and inspect its docID(), nextDoc(), and advance(int) contract, then audit implementations and wrappers such as ConjunctionDISI. Determine which implementations already track the current document and which must copy a wrapped iterator's value; done means the field-based contract works consistently across the affected implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100