Skip to content

Conversation

jainankitk
Copy link
Contributor

Description

Reusing count() for minor refactor in SortedNumericDocValuesRangeQuery

Copy link
Contributor

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR.

@jainankitk jainankitk added the skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check. label Aug 25, 2025
@jpountz
Copy link
Contributor

jpountz commented Aug 25, 2025

Javadocs of LeafReader#numDocs warn that it may run in O(maxDoc) time. I wonder if we should instead extract a method that tells whether it matches all or nothing (without calling numDocs()) and then use it from count() (plus calling numDocs()) and scorerSupplier()?

@jainankitk
Copy link
Contributor Author

That's a good point. I was initially thinking of doing that by adding relate method similar to PointRangeQuery, but thought this could be simpler. I overlooked this key detail regarding LeafReader#numDocs potentially taking O(maxDoc) time.

Signed-off-by: Ankit Jain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:core/other skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants