feat(memory): FTS5 index for graph entities (#1232)#1254
Merged
Conversation
Add FTS5 full-text search index for graph_entities table, replacing LIKE '%query%' with FTS5 MATCH + bm25 ranking in find_entities_fuzzy. - Migration 023_graph_entities_fts5.sql: FTS5 virtual table with unicode61 tokenizer (remove_diacritics=2), content-sync triggers (INSERT/DELETE/UPDATE), and backfill from existing entities - find_entities_fuzzy: FTS5 MATCH with prefix wildcards, bm25 ranking (name 10x weight over summary), FTS5 operator filtering (AND/OR/NOT/NEAR) - Reuse sanitize_fts5_query from messages module (pub(crate)) - 7 new tests (+1 during review fixes), test count 4244 -> 4251 Closes #1232
Resolve conflicts in CHANGELOG.md, README.md, and docs/src/concepts/graph-memory.md — keep both branches' additions.
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
graph_entitiestable (migration023_graph_entities_fts5.sql)LIKE '%query%'with FTS5 MATCH + bm25 ranking infind_entities_fuzzysanitize_fts5_queryfrom messages module, add FTS5 operator filtering (AND/OR/NOT/NEAR)remove_diacritics=2, name column weighted 10x over summarygraph_entitiesfind_entities_fuzzysignature unchangedBehavioral change: FTS5 prefix matching replaces LIKE substring matching. Searching "SQL" matches "SQLite" (prefix) but not "GraphQL" (mid-word substring). Documented in code and CHANGELOG.
Test plan
--features full)cargo +nightly fmt --checkcleancargo clippy --workspace --features full -- -D warningscleanFollow-up issues
last_seen_at-only changesfind_entities_fuzzyretrieval.rsper-word loop to pass full query to FTS5 nativelyCloses #1232
Part of #1222