Skip to content

feat(fts): add with_limit to PhraseQueryExec - #11659

Merged
hamersaw merged 1 commit into
lance-format:mainfrom
hamersaw:feat/fts-phrase-exec-with-limit
Dec 2, 2026
Merged

hamersaw merged 1 commit into
lance-format:mainfrom
hamersaw:feat/fts-phrase-exec-with-limit

Conversation

@hamersaw

Copy link
Copy Markdown
Contributor

Callers that over-fetch a bounded FTS leaf need to raise FtsSearchParams::limit. The limit lives inside the exec, not in a fetch node, so with_fetch can't reach it. #10658 added with_limit to MatchQueryExec and FlatMatchQueryExec, and the compound execs already had one. PhraseQueryExec was the remaining indexed leaf without it.

Without with_limit, a caller has to rebuild the node through a constructor. The constructors don't take the overlay block, the external mask or the shared corpus scorer, so a rebuild either drops rows lance excluded as superseded or breaks the binding SharedFtsScorerExec checks at execution.

PhraseQueryExec::with_limit copies the node whole and changes only the limit, following MatchQueryExec::with_limit.

Testing

test_phrase_query_exec_with_limit_keeps_domain: a phrase leaf scoped to one segment, widened from limit 1 to 20, still returns only that segment's rows even though every fragment matches. A leaf bound to a shared scorer keeps the same scorer by identity after widening.

🤖 Generated with Claude Code

Callers that over-fetch a bounded FTS leaf raise `FtsSearchParams::limit`,
which lives in the exec rather than in a fetch node. `MatchQueryExec`,
`FlatMatchQueryExec` and the compound execs already expose `with_limit` for
this; `PhraseQueryExec` did not, so callers had to rebuild it through a
constructor that drops its overlay block, external mask and shared scorer.
Losing those widens the search domain or breaks the corpus-node binding.

`with_limit` copies the node whole and changes only the limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the enhancement New feature or request label Nov 30, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The limit rewrite preserves the existing search domain and shared scorer binding. No blocking issues found.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 30, 2026
@hamersaw
hamersaw merged commit 9a81354 into lance-format:main Dec 2, 2026
42 checks passed
@hamersaw
hamersaw deleted the feat/fts-phrase-exec-with-limit branch December 2, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants