fix(index): use range block max for fts conjunction#7387
Open
BubbleCal wants to merge 5 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Bug Fix
What is the bug?
FTS AND/conjunction block-max pruning could only ask a posting for its current block max score. When the lead posting defines a wider
up_towindow, another posting can have a higher block max later in that same window, so using only its current block can understate the safe upper bound for Lucene-stylegetMaxScore(upTo).What issues or incorrect behavior does the bug cause?
The understated upper bound can make
and_advance_targetskip a lead block window even though a later document in that window could still beat the current top-k threshold. For exact BM25 search, pruning must use a safe upper bound so possible top-k documents are not dropped.How does this PR fix the problem?
This adds a query-time
BlockMaxWindowto compressed posting iterators. The window lazily maintains a monotonic deque of block max scores over[current shallow block, block containing up_to]. AND/conjunction now lets the lead posting chooseup_toand asks each follower for a range max that safely covers that sameup_to. Plain postings still fall back to their existing list-level upper bound. This does not change the index format or posting-list build path.Tests
cargo fmt --all --checkgit diff --checkCARGO_TARGET_DIR=/tmp/lance-target-fts-and-rangemax-main cargo test -p lance-index scalar::inverted::wand::tests -- --nocaptureCARGO_TARGET_DIR=/tmp/lance-target-fts-and-rangemax-clippy cargo clippy --all --tests --benches -- -D warnings