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

Document expected score ranges for ranking results #3022

Open
cspotcode opened this issue Oct 12, 2024 · 8 comments
Open

Document expected score ranges for ranking results #3022

cspotcode opened this issue Oct 12, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@cspotcode
Copy link

Is your feature request related to a problem? Please describe.

I am writing a JSON-RPC plugin. I cannot call Flow's API from an RPC plugin, so I cannot use Flow's fuzzy matching implementation IPublicAPI.FuzzySearch(…) I am using Fuse.js, which ranks as a float from 1 to 0, and I'm converting to an int from 0 to 1000.

My plugin's results are way above all other plugins, so clearly I am ranking them much too high.

What is the correct range of int values I should use? 0 to 10? 0 to 500?

Describe the solution you'd like

Ideally, RPC plugins gain access to IPublicAPI so I can use Flow's own fuzzy matcher scoring. Barring that, it would be nice if the plugin documentation described the ideal range of scores.

Describe alternatives you've considered

Additional context

@cspotcode cspotcode added the enhancement New feature or request label Oct 12, 2024
@cspotcode
Copy link
Author

This page suggests numbers 0 to 100:
https://www.flowlauncher.com/docs/#/nodejs-write-code?id=_6-result-score

However, this ticket suggested higher values: 50, 100, 150: #2904 (comment)

@taooceros
Copy link
Member

Flow's Fuzzy search has a score range between 0-100, so if you want it to be used along with other plugin and not messing us the ordering, that maybe a good choice. If it is most likely be used with an action keyword, then any score range is fine.

@taooceros
Copy link
Member

The ticket is saying that we re-order results based on user selection. If no ordering is what you want then higher score may be prefered.

@cspotcode
Copy link
Author

Thank you, this is helpful.

we re-order results based on user selection.

Does this mean that Flow tracks commonly-selected options and gives them a higher score? Is this implemented by IPublicAPI.FuzzySearch(…) or is it a modification made after FuzzySearch has generated a score?

In other words, what is the correct way for an RPC plugin -- Executable, in my case -- to support re-ordering based on user selection?

@taooceros
Copy link
Member

It is implemented when user execute the results. You don't have to do much, except keeping the Title and Subtitle consistent.

@cspotcode
Copy link
Author

This is still unclear to me. My RPC plugin cannot call FuzzySearch. So how does re-ordering work, if I am unable to use Flow's ranking API? My plugin will always generate an identical score for each item, because I'm using my own ranking library -- fuze.js -- which does not know about the user's past selections.

@taooceros
Copy link
Member

We cache the result that user click using the result title and subtitle. Next time the same title and subtitle results appear, we will increase the score.

@cspotcode
Copy link
Author

I see. My plugin should always return the same title, subtitle, and score. Then Flow Launcher will boost the scores from my plugin for commonly-selected items.

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

No branches or pull requests

2 participants