-
-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmdpalette] fix scoring of space-separated search terms #2646
base: develop
Are you sure you want to change the base?
Conversation
Thank you very much |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, @midichef !
Hi @midichef what should I do if I want to use it? Do I must install the develop version running Thak you to you, @saulpw and @anjakefala |
Previously only the score for the final search term was used.
09567e1
to
264387d
Compare
I pushed a new commit that didn't change any code, only the description, to insert a |
@aborruso yes, once the PR is accepted into the
|
@aborruso |
Thank you @midichef a stupid question: is it better first to uninstall the version I have and then install the new? |
I uninstall first. But I don't actually know if that is better. |
@midichef wow, it works. I had noticed this for a very long time. I had never written it down, because it seemed strange to me that no one had ever noticed it, and then I thought there must be some reason why it must be malfunctioning :) Thank you again |
Fixes part of #2645.
When multiple search terms are used in
fuzzymatch()
, not all the terms are used for a match. Only the last matching term is used to score each part of the match. That is, forlongname
, only the last matching term's score is used, and fordescription
, only the last matching term's score is used.To see this, hit
Space
, then typeselect a
.select-after
should be the top result, but it's not shown at all. (The proper rankings should look more like what you see searching forselecta
with no space.)That's because
select-after
is incorrectly scored as a match fora
only, not as a match forselect
and a match fora
. So it is incorrectly pushed way down the ranking. That leavesselect-error-col
as the top result, because it does not have any match fora
dragging it down. It gets the highest score by matching solely forselect
and not fora
.This PR lets each term contribute to a combined score. With it,
select a
properly ranksselect-after
andselect-around-n
as the top two results. (There are remaining differences in the rankings withselecta
vsselect a
, because theselect a
search adds a bonus to results wheredescription
hasa
at the start of a word instead of just in the middle.)