Repository navigation
feat(#250): FTS5 hybrid search with Reciprocal Rank Fusion (RRF) - #261
Conversation
- New module: memory/fts5.rs — FTS5 virtual table, triggers, phrase/token search - Schema migration v1→v2: auto-create FTS5 table + rebuild index for existing DBs - RecallStrategy enum: hybrid (default), vector, fts5 - recall_hybrid() routes by strategy - recall_rrf() merges vector + FTS5 via Reciprocal Rank Fusion (k=60) - FTS5 triggers keep index in sync on insert/delete/update - Phrase search with token-OR fallback for broader matching - Deprecated memories excluded from FTS5 results - Graceful fallback: FTS5 fail → vector-only, vector fail → FTS5-only - 6 new tests: search, tokens, namespace, rebuild, deprecated, exists Fixes: #250
|
Warning Review limit reached
More reviews will be available in 40 minutes and 31 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (4)
Review powered by cora-cli · BYOK · MIT |
* fix: address Cora review critical issues (7 items) FTS5 (from PR #261): - Fix BM25 score conversion: rank is negative unbounded, clamping to 0..1 produced 0.0 for all results. Now uses rank-based scoring (placeholder 1.0) since actual ranking is done by RRF in hybrid. - Fix RRF normalization: denominator calculation was correct but .min(1.0) was misleading. Replaced with explicit .clamp(0.0, 1.0). - Replace memories.remove().unwrap() with expect() for clearer panic msg. Metadata (from PR #262): - Replace as_object_mut().unwrap() with if-let pattern to prevent panic. - Server-mode remember now includes entity/category/meta in request body instead of silently ignoring them. * style: cargo fmt
* feat(#250): FTS5 hybrid search with Reciprocal Rank Fusion - New module: memory/fts5.rs — FTS5 virtual table, triggers, phrase/token search - Schema migration v1→v2: auto-create FTS5 table + rebuild index for existing DBs - RecallStrategy enum: hybrid (default), vector, fts5 - recall_hybrid() routes by strategy - recall_rrf() merges vector + FTS5 via Reciprocal Rank Fusion (k=60) - FTS5 triggers keep index in sync on insert/delete/update - Phrase search with token-OR fallback for broader matching - Deprecated memories excluded from FTS5 results - Graceful fallback: FTS5 fail → vector-only, vector fail → FTS5-only - 6 new tests: search, tokens, namespace, rebuild, deprecated, exists Fixes: #250 * style: cargo fmt * fix: use derive Default for RecallStrategy (clippy compat)
* fix: address Cora review critical issues (7 items) FTS5 (from PR #261): - Fix BM25 score conversion: rank is negative unbounded, clamping to 0..1 produced 0.0 for all results. Now uses rank-based scoring (placeholder 1.0) since actual ranking is done by RRF in hybrid. - Fix RRF normalization: denominator calculation was correct but .min(1.0) was misleading. Replaced with explicit .clamp(0.0, 1.0). - Replace memories.remove().unwrap() with expect() for clearer panic msg. Metadata (from PR #262): - Replace as_object_mut().unwrap() with if-let pattern to prevent panic. - Server-mode remember now includes entity/category/meta in request body instead of silently ignoring them. * style: cargo fmt
Summary
Add FTS5 full-text search as a parallel retrieval channel alongside vector similarity search, merged via Reciprocal Rank Fusion (RRF).
Changes
New module:
memory/fts5.rscontent=memories(shadow table)rebuild_fts5()for migration from existing dataSchema migration v1 → v2
Hybrid recall with RRF
RecallStrategyenum:hybrid(default),vector,fts5recall_hybrid()routes by strategyrecall_rrf()merges both channels:score = 1/(k + rank_vector) + 1/(k + rank_fts5)Benchmark rationale (from issue)
Verification
cargo clippy --all-targets -- -D warnings— cleancargo test— 107/107 pass (6 new FTS5 tests)Fixes: #250