BugFix: Fixed Advance() API implementation in Optimized Composite Searchers#2146
Merged
Conversation
Member
|
@CascadingRadium would you add a unit test for the code in question here demonstrating the issue which your commit is meant to address. |
Member
Author
|
Done, The added test The reason why this issue was uncaught was that the existing implementation does not utilize the Thanks. |
abhinavdangeti
previously approved these changes
May 22, 2025
abhinavdangeti
approved these changes
May 22, 2025
Likith101
approved these changes
May 23, 2025
CascadingRadium
added a commit
that referenced
this pull request
Aug 21, 2025
…rchers (#2146) - When using the `Advance()` API on an `IndexSnapshotTermFieldReader`, a special replacement mechanism is applied during a `Rewind`— when the requested document ID is behind the current document ID pointed to by the reader. In such cases, the object itself gets replaced. - However, this approach fails when the `IndexSnapshotTermFieldReader` is created by the `optimizeCompositeSearcher` method, which is used to construct optimized `conjunction` or `disjunction` searchers. - The issue arises because the `unadornedTermFieldReader` is initialized with the `term` set to `<optimization-type>` and `field` set to `*`. As a result, calling `Advance()` renders the entire `TFR` unusable, as it gets replaced by a dummy `TFR` that no longer functions. - This problem occurs specifically when calling `Advance()` on the `unadornedTermFieldReader` with an ID less than the current posting ID (triggering the rewind mechanism). - The issue is resolved by resetting the underlying `unadornedPostingsIteratorBitmap`, which effectively achieves the same result as the `TFR` replacement technique without rendering it unusable.
CascadingRadium
added a commit
that referenced
this pull request
Sep 3, 2025
- Add a Filter query for Boolean queries, which filters the document set returned by the Boolean query itself. - The filter query does not affect scores, and any document returned by the Boolean query must also satisfy the filter query. - The key difference between using a Filter query and placing an equivalent query in the Must clause is that queries in the Must clause contribute to the score. The Filter query is intended purely for filtering purposes without modifying the document scores set by the base Boolean query. - Requires a Bug Fix (#2146) to allow for the usage of the Advanced API in case the FilterQuery is an optimized composite searcher. - Resolves #2037
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.
Advance()API on anIndexSnapshotTermFieldReader, a special replacement mechanism is applied during aRewind— when the requested document ID is behind the current document ID pointed to by the reader. In such cases, the object itself gets replaced.IndexSnapshotTermFieldReaderis created by theoptimizeCompositeSearchermethod, which is used to construct optimizedconjunctionordisjunctionsearchers.unadornedTermFieldReaderis initialized with thetermset to<optimization-type>andfieldset to*. As a result, callingAdvance()renders the entireTFRunusable, as it gets replaced by a dummyTFRthat no longer functions.Advance()on theunadornedTermFieldReaderwith an ID less than the current posting ID (triggering the rewind mechanism).unadornedPostingsIteratorBitmap, which effectively achieves the same result as theTFRreplacement technique without rendering it unusable.