Remove Scorer.iterator [LUCENE-7765]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
There are two ways that you can consume the documents that a `Scorer` matches: `Scorer.iterator()` and `Scorer.twoPhaseIterator()`, which is optional (it returns null if two-phase iteration is not supported). I think it made sense to make two-phase iteration optional in the beginning but it also has the drawback that it is too easy to forget to delegate two-phase iteration in compound queries (see eg. LUCENE-7654) so I am considering removing `Scorer.iterator` so that all scorers would be consumed using two-phase iteration.
It would probably be undesirable to use two-phase iteration on simple (combinations of) term queries, but I guess that could be easily addressed by using a special implementation of `TwoPhaseIterator` for the case that the approximation is accurate and eliminating it eg. in `ConjunctionDISI`.
---
Migrated from [LUCENE-7765](https://issues.apache.org/jira/browse/LUCENE-7765) by Adrien Grand (@jpountz), updated Apr 04 2017
Contributor guide
Research direction
Start by reading the Scorer.iterator() and Scorer.twoPhaseIterator() APIs, then inspect the compound-query delegation problem referenced by LUCENE-7654. Trace how scorers are consumed and evaluate the proposed TwoPhaseIterator handling for accurate approximations. Done would require a decided migration away from Scorer.iterator without breaking scorer consumption.
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
- Needs clarification
- Newbie friendliness
- 25/100