fix(core): search complete SQLite note content - #1071
Merged
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
This was referenced Aug 12, 2026
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.
Why
SQLite text search only matched
titleand the Postgres-sizedcontent_stemsprefix. Becausecontent_stemsis capped near 6,000 characters while the full note is already indexed in FTS5 ascontent_snippet, exact terms later in large notes were invisible.Closes #1065.
What Changed
content_snippetFTS5 column in text-search matching.content_stems.Implementation Details
The existing SQLite query builder is shared by
search()andcount(), including the metadata-filter subquery path. Extending that single match predicate fixes all SQLite keyword consumers without changing the stored index or requiring users to reindex.Postgres behavior is unchanged; its indexed
content_stemsremains capped for the 8 KB index-row constraint.Testing
uv run pytest tests/repository/test_search_repository.py -q— 48 passed.just fast-check— passed (ruff, format, and type checking; existing Python 3.14 deprecation warnings only).just fast-test— 123 passed and 1 skipped before the selected live OpenAI/Postgres benchmark failed with external429 insufficient_quota.env OPENAI_API_KEY= just fast-test— the remaining live OpenAI case skipped as intended.Risks / Follow-ups
SQLite BM25 ranking can shift slightly because terms present in both
content_stemsandcontent_snippetcontribute from both columns. That is preferable to silently dropping exact matches in long notes, and no migration or reindex is required.