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

Add capability to disable Flow Launcher result auto rank system (i.e. Score) for plugins where result order matters

Open Or1g3n opened this issue 1 year ago • 1 comments

Discussed in https://github.com/Flow-Launcher/Flow.Launcher/discussions/2993

Originally posted by Or1g3n September 24, 2024 Plugin developer question - is there a way to disable flow launchers auto rank system when result order matters

I maintain a plugin where order matters (e.g., help feature shows available commands that should be ordered alphabetically, there is a sort feature where user can specify sort order, etc.). The issue I have found is that flow launcher appears to keep a ranking of results in a UserSelectedRecord.json file and that this ranking takes precedence over all; I tried hard coding a sort order in the c# list object but the ranking by Flow still took precedence; clearing the data stored in the UserSelectedRecord.json resulted in expected sort order.

I can see why this auto ranking system can be very useful in most use cases given it avoids the user having to manually search multiple matches to select the most common result record, however, in for my use case where sort order matters, this is not the desired behavior.

Is there a way to turn this off using the plugin api?

Suggestion

Either via Flow.Launcher.Plugin API or other mechanism, enable way for auto rank process to ignore plugins based on a flag property. So if theoretical property is set, Flow Launcher will ignore that plugin and not add result to UserSelectedRecord.json file. If we want to allow for more flexibility then this property could be part of the Result class so that the plugin developer can specify for a given List<Result> to enable auto rank or disable auto when user interacts with result set. I am new to Flow Launcher plugin dev so tried my best to find the mechanism for this.

It appears to be here: https://github.com/Flow-Launcher/Flow.Launcher/blob/67cf6b6eda3a92fdaf31cb16c3796a609bf0c66d/Flow.Launcher/ViewModel/ResultsViewModel.cs#L231-L240

Or1g3n avatar Sep 26 '24 01:09 Or1g3n

I've kept the whitespace-only lines to maintain indentation and make it easier to move the cursor and add new characters. I'll try out your suggestion later.

ibireme avatar Oct 07 '24 11:10 ibireme

@ibireme Keep your style! It's your project. :) Most editors can be configured per path or project in one way or another.

zuiderkwast avatar Dec 18 '24 23:12 zuiderkwast

The code style that removes trailing spaces is more widely accepted. This issue will be fixed by PR #195 .

ibireme avatar Feb 12 '25 14:02 ibireme