BooleanQuery: narrow bulk scoring when FILTER matches primary index sort#15991
Open
iprithv wants to merge 6 commits intoapache:mainfrom
Open
BooleanQuery: narrow bulk scoring when FILTER matches primary index sort#15991iprithv wants to merge 6 commits intoapache:mainfrom
iprithv wants to merge 6 commits intoapache:mainfrom
Conversation
Signed-off-by: prithvi <[email protected]>
Signed-off-by: prithvi <[email protected]>
Signed-off-by: prithvi <[email protected]>
fe1fe81 to
9df46b8
Compare
Signed-off-by: prithvi <[email protected]>
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.
Description
Implements #15139 : When a
BooleanQueryhas aFILTERclause that constrains the primary index sort field, rewrite to an internal query that can restrict the main clause'sBulkScorerto a contiguous doc ID range derived from the filter, when it is safe to do so.The optimization currently applies to:
SortedSetSortFieldwhen doc values and postings agree on a dense rangeIf the range cannot be proven safe for a leaf, execution falls back to the original boolean query's bulk scorer for that leaf.
Benchmarking
Focused JMH benchmark:
PrimaryIndexSortFilterBenchmarkorigin/main)benchmarkSortedTopScores1.315 ± 0.013 ops/ms2.286 ± 0.032 ops/ms~+74%benchmarkSortedComplete1.491 ± 0.020 ops/ms2.145 ± 0.137 ops/ms~+44%benchmarkSortedCompleteNoScores3.249 ± 0.027 ops/ms4.774 ± 0.035 ops/ms~+47%benchmarkUnsortedTopScores1.306 ± 0.014 ops/ms1.334 ± 0.009 ops/ms~+2%These numbers compare
origin/mainwith the same benchmark class copied in against this branch, using the benchmark's full JMH annotations.