Flow.Launcher icon indicating copy to clipboard operation
Flow.Launcher copied to clipboard

Document expected score ranges for ranking results

Open cspotcode opened this issue 1 year ago • 1 comments

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 avatar Oct 12 '24 20:10 cspotcode

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: https://github.com/Flow-Launcher/Flow.Launcher/issues/2904#issuecomment-2295155883

cspotcode avatar Oct 12 '24 20:10 cspotcode

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 avatar Oct 29 '24 05:10 taooceros

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.

taooceros avatar Oct 29 '24 05:10 taooceros

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?

cspotcode avatar Oct 29 '24 14:10 cspotcode

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

taooceros avatar Oct 29 '24 14:10 taooceros

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.

cspotcode avatar Oct 29 '24 15:10 cspotcode

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.

taooceros avatar Oct 29 '24 16:10 taooceros

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.

cspotcode avatar Oct 29 '24 18:10 cspotcode

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 60 days.\n\nAlternatively this issue can be kept open by adding one of the following labels:\nkeep-fresh

github-actions[bot] avatar Dec 29 '24 02:12 github-actions[bot]

There is an option in the API of upcoming v1.20.0 release to keep result order. Closing this.

jjw24 avatar Jan 04 '25 00:01 jjw24