jpountz opened a new issue, #15139:
URL: https://github.com/apache/lucene/issues/15139
### Description
Filtering on the primary index sort field is already quite efficient, but we
could do better. E.g. consider the following query `+description:(Apache
Lucene) #category:books`, assuming an index sorted by `category`.
The most efficient way to evaluate this query would consist of computing the
range of doc IDs that the `category: books` filter matches, and then evaluate
the `description:(Apache Lucene)` query using it bulk scorer
(`MaxScoreBulkScorer` in this case) on this range of doc IDs instead of the
whole doc ID space.
My suggestion for implementing this would consist of:
- Introducing a new `FilteredOnPrimaryIndexSortFieldQuery`, not exposed to
users
- Rewriting `BooleanQuery` to a `FilteredOnPrimaryIndexSortFieldQuery` that
wraps the same `BooleanQuery` minus the filter on the primary sort field when
applicable
- Making `FilteredOnPrimaryIndexSortFieldQuery`'s bulk scorer compute the
range of doc IDs matched by the filter at creation time, and then intersect
ranges of doc IDs passed to `BulkScorer#score` with the range of doc IDs
matched by the filter before delegating.
This would be quite nice as many queries would perform as fast as if they
were running in a Lucene index that only contained documents matched by the
filter.
--
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]