fix(search): match snake_case identifiers in BM25 queries#326
Closed
fix(search): match snake_case identifiers in BM25 queries#326
Conversation
Contributor
Author
|
Thanks. This change is small and still looks directionally fine, but the branch has gone stale and is now conflicting with the base branch. Rather than keep a conflicting PR open without active reviewer traction, I am closing this out here. If it still makes sense against current main later, I would prefer to reopen it as a fresh rebase or smaller follow-up. |
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.
This fixes BM25 search for snake_case identifiers such as
atomic_write_json.What changed:
Why:
SQLite FTS5 with the
unicode61tokenizer splitssnake_caseinto separate tokens at index time. The previous query sanitization removed underscores, turningatomic_write_jsonintoatomicwritejson, which could not match the indexed tokens.How I tested it:
search "atomic_write_json"returned[]search "atomic write json"returned the expected documentsearch "atomic_write_json"returns the expected documentsearch "parse_http_response"returns the expected documenttest/structured-search.test.tstest/cli.test.tsFixes #305