Repository navigation
fix: Match file stems with leading or trailing underscores in the NL stem boost - #304
Closed
flyinprogrammer wants to merge 1 commit into
Closed
flyinprogrammer wants to merge 1 commit into
flyinprogrammer wants to merge 1 commit into
Conversation
…stem boost
split_identifier("__git") returns ["__git"], so a query mentioning "git" never
earned the stem boost for files like telescope.nvim's __git.lua. Strip leading and
trailing underscores from file stems and directory names before splitting them
for the stem boost. BM25 tokenization is unchanged.
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.
Closes #303
Summary
The NL stem boost splits file stems and directory names with
split_identifier, which returns["__git"]for__git, so the keywordgitnever matches. Strip leading and trailing underscores first, in the stem boost only:split_identifierand BM25 tokenization are unchanged.Evidence
The new parametrized cases in
test_apply_query_boost_nl_stem_match_boostscover a leading-underscore case,("git status", "lua/telescope/__git.lua"), and a trailing-underscore case,("git status", "lua/telescope/git__.lua").main'sboosting.py):FAILED test_apply_query_boost_nl_stem_match_boosts[git status-lua/telescope/__git.lua]. The score stays at 0.5. The trailing case already passes through the prefix match and is kept as a regression guard.make test393 passed;make lintandmake typecheckclean.run_benchmarkNDCG@10 goes from 0.852 to 0.854. Few files are named this way, so the effect is small.Merge Danger
Door: two-way
A ranking-only change with no index or cache format change; reverting restores the old ranking exactly.
Blast Radius: ranking
It only affects natural-language queries over files or directories whose names start or end with
_.