Optimize stable full-text pagination and update Tantivy - #46
Merged
Merged
Conversation
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.
Summary
This improves native full-text search and indexing in five areas:
anysearchesThe public API and wire protocol are unchanged.
Reviewer focus
anysearches use the same score-and-ID collector path for every page. Clause count is analyzed terms multiplied by selected fields, so a single-term search over two fields takes this path. This avoids cross-page score drift from mixing scorer topologies, but it enumerates every match and reads the ID fast field for each match. It remains in the cheap admission class and checks its deadline after collection. The observed one-million-record benchmark stayed below the 50 ms p99 target, but it did not isolate the bounded, non-exact shape that lost pruning. Qualification at catalog scale remains open in Prove native checkpoint publication and the Harper derived-index path.surfaceTerms: trueandpositions: truefail to open withE_SCHEMA_MISMATCHand must rebuild from source before serving searches. Rebuild time at catalog scale has not been measured.Changes
anyterm queries into oneShouldunion.Countquery.IndexRecordOption::WithFreqs.LogMergePolicy::set_del_docs_ratio_before_merge(0.5)on every writer.File guide:
src/engine.rscontains the collector, exact-total, metadata batching, surface-field, and merge-policy changes;src/lib.rsreports the matching ABI revision.Cargo.toml,Cargo.lock, anddependencies.mdupdate and record Tantivy 0.26.2.README.md,docs/native-backend-implementation.md,docs/native-reset-quiescence.md, anddocs/release-packaging.mddescribe stable pagination, schema compatibility, the Tantivy ownership boundary, reset behavior, benchmark interpretation, and the post-publish release benchmark record.test/native-index.test.mjscovers exact and bounded totals through the public API;test/package.release.test.mjsupdates the packaged ABI expectation..github/workflows/claude-review.ymland.github/workflows/gemini-review.ymlcall the shared, SHA-pinned native-addon reviewers with identical Fulltext rules;.github/workflows/validate-caller-workflows.ymlrejects shadow jobs and mutable refs.CONTRIBUTING.mddocuments the opt-in labels, optional always-on variables, re-review gesture, and fork limitation.Observed performance
These are local internal-harness results, not catalog-scale guarantees.
any, concurrency 1, two alternating runsThe one-million-product query run produced:
anyanyFiltered p99 remains above the proposed 50 ms target. The stable bounded
anypath remains the primary catalog-scale risk.Rejected experiments
Observed locally:
anythroughput from 3,713 to 3,605 QPS.Verification
npm run check: formatting, TypeScript, clippy, 64 Rust tests, 142 Node tests, 5 worker tests, examples, and package checksnpm run test:optimized-native: optimized native concurrencycargo deny check: advisories, bans, licenses, and sourcesClaude and Cursor Grok reviewed the runtime code. Google Gemini CLI reviewed the preceding runtime state; both findings from that pass are fixed. A final local ownership audit compared the implementation with Tantivy 0.26.2 and prompted the native-collector A/B above. Claude Opus and the Gemini CLI both cleared the final AI-review workflow commit after their findings were addressed.
Related: Prove native checkpoint publication and the Harper derived-index path
Comment generated by kAIle (gpt-6-astra)
Complexity: complicated
Review-Coverage: authored=codex; ran=claude,cursor-composer,cursor-grok; adjudicated=domain; blocked=gemini(auth); rounds=11; full=5 @ 2854d90
Human-Review-Need: 4 @ 2854d90