apache / apache/lucene

Could `PointRangeQuery`'s boundary values used for `NumericComparator` to calculate `estimatedNumberOfMatches`

Open
#11,773 3 comments 0 reactions 0 assignees View on GitHub
discussion type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Now when we do TopK search, we could rebuild `DocIdSetIterator` to reduce candidate docs since [LUCENE-9280](https://issues.apache.org/jira/browse/LUCENE-9280) .

One condition of rebuilding `DocIdSetIterator` is that it must reduce number of docs at least 8x. But when we do TopK search by `PointRangeQuery`, it's `estimatedNumberOfMatches` contains some docs which are out of boundaries.Could we take advantage of range query's boundary values to make this condition much more easier to achieve?

Since [LUCENE-10620](https://issues.apache.org/jira/browse/LUCENE-10620) we pass `Weight` to `Collecter`, it might be able to do this optimization?

Contributor guide

Open the contributing guide

Research direction

Start by reading LUCENE-9280 and LUCENE-10620, then trace how PointRangeQuery, NumericComparator, estimatedNumberOfMatches, Weight, and Collector interact during TopK search. Done means establishing whether range boundary values can safely improve the eightfold candidate-reduction condition and documenting or implementing the agreed optimization with supporting evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.