Overrides rewrite in PointRangeQuery to optimize AllDocs/NoDocs cases#14609
Merged
jainankitk merged 5 commits intoapache:mainfrom May 10, 2025
Merged
Overrides rewrite in PointRangeQuery to optimize AllDocs/NoDocs cases#14609jainankitk merged 5 commits intoapache:mainfrom
jainankitk merged 5 commits intoapache:mainfrom
Conversation
…range either fully contains or fully excludes all documents within the shard.
jpountz
reviewed
May 5, 2025
Contributor
jpountz
left a comment
There was a problem hiding this comment.
I left some minor comments but the change looks good to me in general. Thank you!
jainankitk
reviewed
May 7, 2025
lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java
Outdated
Show resolved
Hide resolved
- Fixes annotation ordering - Pulls relate method out of inner class and refactors rewrite to use it
Contributor
Author
|
I think we're good now. Let me know if you guys see anything else, and thanks for the quick review! |
jpountz
approved these changes
May 9, 2025
Contributor
jpountz
left a comment
There was a problem hiding this comment.
LGTM, can you add a CHANGES entry?
lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java
Outdated
Show resolved
Hide resolved
…MatchNoDocsQuery if no point values exist
jainankitk
approved these changes
May 10, 2025
Contributor
|
Thanks @ebradshaw for this change, and congratulations on your first contribution in lucene! :) |
jainankitk
pushed a commit
that referenced
this pull request
May 10, 2025
jainankitk
added a commit
to jainankitk/lucene
that referenced
this pull request
May 10, 2025
jainankitk
added a commit
that referenced
this pull request
May 10, 2025
weizijun
added a commit
to weizijun/lucene
that referenced
this pull request
May 16, 2025
* main: (31 commits) Fix termination condition in TestStressNRTReplication. (apache#14665) deps(java): bump com.gradle.develocity from 3.19 to 3.19.2 (apache#14662) Build: remove hard-coded Java versions from ecj.javadocs.prefs (apache#14651) Update verifier comment to show label (apache#14658) Catch and re-throw Throwable rather than using a success boolean (apache#14633) Mention label in changelog verifier comment (apache#14656) Enable PR actions in changelog verifier (apache#14644) Fix FuzzySet#getEstimatedNumberUniqueValuesAllowingForCollisions to properly account for hashCount (apache#14614) Don't perform additional KNN querying after timeout, fixes apache#14639 (apache#14640) Add instructions to help/IDEs.txt for VSCode and Neovim (apache#14646) build(deps): bump ruff from 0.11.7 to 0.11.8 in /dev-tools/scripts (apache#14603) deps(java): bump de.jflex:jflex from 1.8.2 to 1.9.1 (apache#14583) Use the preload hint on completion fields and memory terms dictionaries. (apache#14634) Clean up FileTypeHint a bit. (apache#14635) Expressions: Improve test to use a fully private class or method Remove deprecations in expressions (apache#14641) removing constructor with deprecated attribute 'onlyLongestMatch (apache#14356) Moving CHANGES entry for apache#14609 from 11.0 to 10.3 (apache#14638) Overrides rewrite in PointRangeQuery to optimize AllDocs/NoDocs cases (apache#14609) Adding benchmark for histogram collector over point range query (apache#14622) ... # Conflicts: # lucene/CHANGES.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overrides rewrite in PointRangeQuery range to handle cases where the query either fully contains or fully excludes all documents within the shard.
Often, particularly when using time based partitioning, range queries may overlap several indexes. Many of these indexes have timestamp values that are fully contained by the query, in which case the query can be rewritten to a MatchAllDocsQuery or a FieldExistsQuery. On the other hand, many indexes can be fully excluded if they're outside the requested time range, in which case the query can be rewritten to a MatchNoDocsQuery.
While a similar optimization exists at the leaf level in the createWeight function, rewriting at the shard level enables other optimizations downstream.
Please let me know if this has been ruled out in the past for other reasons or if the implementation misses anything. Thanks.