Fix hyphenated tokens in FTS5 lex queries#463
Merged
Conversation
Hyphenated terms like multi-agent, DEC-0054, gpt-4 were being stripped
of hyphens and concatenated (e.g., "multiagent") which missed matches.
Now they're split into FTS5 phrase queries ("multi agent") so the porter
tokenizer matches them correctly.
zeattacker
pushed a commit
to zeattacker/qmd
that referenced
this pull request
Mar 26, 2026
Fixes multi-agent, DEC-0054, gpt-4 etc being broken in lex search. Cherry-picked from tobi#463 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jaylfc
added a commit
to jaylfc/qmd
that referenced
this pull request
Apr 5, 2026
Fix hyphenated tokens in FTS5 lex queries
jaylfc
added a commit
to jaylfc/qmd
that referenced
this pull request
Apr 5, 2026
Fix hyphenated tokens in FTS5 lex queries
Contributor
|
Thanks for the lex fix — hyphenated tokens in FTS5 queries work correctly now. However, this PR's The |
tanarchytan
referenced
this pull request
in tanarchytan/lotl
Apr 8, 2026
Fix hyphenated tokens in FTS5 lex queries
lucndm
pushed a commit
to lucndm/qmd
that referenced
this pull request
Jun 7, 2026
Fix hyphenated tokens in FTS5 lex queries
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
Fixes #414, #383, #384, #390, #417
Hyphenated tokens like
multi-agent,DEC-0054, andgpt-4were broken in lex search because:sanitizeFTS5Term()strips all non-alphanumeric characters, turningmulti-agentintomultiagent-agentas a negation prefix, somulti-agentbecamemulti NOT agentThis PR:
isHyphenatedToken()to detect compound words with internal hyphenssanitizeHyphenatedTerm()to split them into FTS5 phrase queriesmulti-agentnow becomes"multi agent"(phrase match), not"multiagent"*-sports) still works as before-multi-agent) also work correctlyExamples
multi-agent"multiagent"*"multi agent"DEC-0054"dec0054"*"dec 0054"gpt-4"gpt4"*"gpt 4"multi-agent memory"multi"* NOT "agent"* AND "memory"*"multi agent" AND "memory"*-sports(negation)NOT "sports"*NOT "sports"*(unchanged)Test plan
buildFTS5Querytests pass (no regressions)