Repository navigation
Fix KPI catalog search dropping matches on digit+letter periods - #2
Merged
Merged
Conversation
Claude Code reads both CLAUDE.md and AGENTS.md; keeping the actual guidance in AGENTS.md and having CLAUDE.md just @-import it avoids maintaining two copies of the same document. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CatalogSearch's term regex ([\p{L}\p{N}]+) glued a leading number
directly onto an adjacent word into one token, e.g. "14day" instead of
"14" + "day". Since MatchesAllTerms requires every query term to equal
a whole token, searching list_kpi_screener_options for "RSI 14" found
zero matches even though kpiId 159 ("[RSI] 14day") is exactly that
KPI - the "14" query term never equaled any single token.
Split the regex into [\p{L}]+|[\p{N}]+ so digits and letters tokenize
separately. This fixes both KpiScreenerCatalog and KpiHistoryCatalog,
which share this search helper.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
CatalogSearch's term tokenizer regex ([\p{L}\p{N}]+) glued a number directly onto an adjacent word into a single token, e.g."14day"instead of"14"+"day". SinceMatchesAllTermsrequires every query term to equal a whole token,list_kpi_screener_optionsreturned zero matches for"RSI 14"even thoughkpiId 159("[RSI] 14day") is exactly that KPI.[\p{L}]+|[\p{N}]+so digits and letters tokenize separately, fixing this for bothKpiScreenerCatalogandKpiHistoryCatalog(they shareCatalogSearch.MatchesAllTerms). Verified live:"RSI 14"now returns exactlykpiId 159, correctly excluding the unrelated RSI trend variants (1day/3day/5day/7day).CLAUDE.md's content intoAGENTS.mdwithCLAUDE.mdnow just@-importing it, so the guidance isn't duplicated across both files Claude Code reads (this was already staged in the working tree before this session's investigation started).Test plan
LookupMatchesNumericTermGluedToLetterSuffixInDescriptionregression test covering the"RSI 14"casedotnet test— all 165 tests pass (157 unit + 8 integration), no regressions🤖 Generated with Claude Code