BlackLab
BlackLab copied to clipboard
Use two-phase iterators
Two-phase iterators are a mechanism in Lucene that can speed up SpanQueries by immediately skipping over documents that cannot possibly contain any matches, before the term vectors are fetched. It might speed up more complex queries.
Lucene docs: https://lucene.apache.org/__root/docs.lucene.apache.org/core/8_0_0/core/org/apache/lucene/search/spans/Spans.html#asTwoPhaseIterator--
It will probably be necessary to read the Lucene code to get a decent understanding of how it uses two-phase iterators before implementing our own.
We might also want to refer to Mtas, which already uses two-phase iterators.
We should probably also look at Weight.isCachable()
. See BLSpanWeight
.