fix(fts): preserve corpus statistics for restricted matches - #9243
ruslan-shaydullin wants to merge 4 commits into
Conversation
Signed-off-by: Ruslan Shaydullin <shaydullin.r.d@outlook.com>
|
Thanks @wjones127 for enabling the previous CI run. It exposed outdated expected plans in Could you approve the five code workflows on this updated head? They currently report |
There was a problem hiding this comment.
The follow-up is verified: 5328449 only aligns the Legacy/Stable test_plans expectations and explanatory comment with the existing MatchCorpus plan; production code is unchanged. The restricted Match correction therefore retains the prior assessment.
The remaining non-blocking risk is operational: selective prefilters or fragment selections must read and tokenize the full unindexed text corpus, so latency and peak memory scale with the unindexed tail until the FTS index is optimized.
|
Hi @sbrunk, would you be able to check the two single-column The updated head has passed Rust, Python and Java CI. This remains a partial fix: |
Related to #9058.
For the two reported single-column
Matchcases, index optimization changes the winner fromalphatobetaafter incorporating already appended rows, although the searchable data and query are unchanged.This partial fix scores eligible restricted matches against committed posting statistics plus the complete unindexed corpus. Flat candidate filtering runs after corpus collection; indexed masks still constrain indexed top-k. A private owner gives each execution a fresh shared scorer. The restricted path handles an effective top-k limit of zero without constructing a zero-sized sort.
The correction covers exact, row-level scalar-string
Matchqueries with a prefilter or explicit fragment selection on the supported append-only corpus. Indexed scoring uses V2/V3 postings. Deletion/stale-text-overlay scoring, legacy postings, fuzzy/phrase/Boolean queries, BM25F/combined_fields, and the unfiltered Hybrid approximation remain outside this correction. #9058 remains open for the broader scoring work.Validation
Upstream CI ran on the original head and exposed outdated
test_plansexpectations on all four Rust platforms. Follow-up5328449updates the Legacy/Stable expected plans and explanatory comment forMatchCorpus, the full unindexed text scan, and separate candidate filtering; production code is unchanged. All four plan-test variants and 65 targeted FTS regressions passed locally, along with formatting, workspace clippy with warnings denied, and applicable commit hooks. Upstream validation on the updated head has now completed: all 37 current checks pass, including the Rust, Python, Java JNI, license-header, and typo workflows.a43e0500; checked scores against an independent raw-text BM25 reference.ciprofile.The global corpus requires reading/tokenizing all unindexed text, including rows outside the candidate set. Corpus construction reuses committed posting statistics without retokenizing indexed text. A scalar prefilter with an overlay-stale index can still contain a consumable
OneShotExec; fresh scorer state does not make that existing input replayable. Sequential/concurrent reuse is verified on the append-only fixtures. No performance claim is made.Thanks to @sbrunk and
lance-gatekeeper[bot]for the report and reproductions during #7905; its emission-filter/shared-scorer work informed this follow-up. Developed with AI assistance and checked against the independent reference and native tests.