Skip to content
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

Odd behaviour in search sesults #15

Open
mikejsdev opened this issue Jul 14, 2021 · 1 comment
Open

Odd behaviour in search sesults #15

mikejsdev opened this issue Jul 14, 2021 · 1 comment

Comments

@mikejsdev
Copy link

Hi,

I have noticed that when searching for a word, results containing all of the letters in that word, even if they are separated by other letters, often appear above results where the word appears in its entirety.

For example when searching "ham" in the example below I would expect this to show the result with "ham" in it first? Is this a deliberate design feature? Is there a way of setting it to take into account the distance between letters?

Thanks for your help.

a1

a2

@fwextensions
Copy link
Owner

The original Quicksilver scoring algorithm was intended to make it easy to launch apps or commands using just a few letters. So matches on capital letters or letters after spaces are scored higher than matches in the middle of a word. That way, you can type ai to match Adobe Illustrator before Brain Teasers or something.

Matches farther into the string are also discounted. If the matches start at the same location, the full match will score higher:

image

I agree these don't always produce exactly the expected order, though usually the desired string is within the top few results.

There are some ways to tweak how some of the internals of the algorithm work, though I haven't documented it yet as I'm not sure it's a very good approach. The config key in the options parameter can be used to pass in a different object to change some of the scoring settings. The code is in config.js.

If you wanted to try disabling the special handling of capitals and beginnings of words, you could try something like this:

const qs = new QuickScore(myItems, { config: { useSkipReduction: () => false } });

I haven't tested it, but I think that should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants