fix(search): handle hyphenated queries and preserve quoted literals in FTS5 - #1777
Closed
eren-karakus0 wants to merge 1 commit into
Closed
fix(search): handle hyphenated queries and preserve quoted literals in FTS5#1777eren-karakus0 wants to merge 1 commit into
eren-karakus0 wants to merge 1 commit into
Conversation
…n FTS5 Split FTS5 query sanitization into quote-aware segments so that balanced quoted phrases (e.g. "exact phrase") are preserved for phrase search, while inter-word hyphens in unquoted text (e.g. chat-send) are converted to spaces to match unicode61 tokenizer behavior. Add debug logging for FTS5 OperationalError to aid future diagnosis. Closes NousResearch#1770
Contributor
Author
|
Closing — already fixed by #1776 (merged by teknium1). Our implementation was nearly identical but arrived ~10 minutes late. |
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
session_searchnow correctly handles hyphenated terms (chat-send) and preserves user-provided quoted literals ("exact phrase") for FTS5 phrase search._sanitize_fts5_query()to split queries into balanced-quoted vs unquoted segments — quoted phrases pass through intact, while unquoted inter-word hyphens are converted to spaces to match unicode61 tokenizer behavior.logger.debugon FTS5OperationalErrorfor diagnosability.Changes
hermes_state.pytests/test_hermes_state.pyTest plan
pytest tests/test_hermes_state.py)chat-sendquery finds hyphenated content (integration test)"deploy docker"phrase search works (integration test)"chat-send"quoted-hyphen regression covered (integration test)