mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 04:12:32 +08:00
Reduce program plugin results (#5743)
* Added minimum score threshold * nit fix for program plugin
This commit is contained in:
parent
dc35fc450b
commit
d21201e996
@ -86,8 +86,11 @@ namespace Microsoft.Plugin.Program
|
||||
.Where(p => p.Enabled)
|
||||
.Select(p => p.Result(query.Search, _context.API));
|
||||
|
||||
var result = results1.Concat(results2).Where(r => r != null && r.Score > 0).ToList();
|
||||
return result;
|
||||
var result = results1.Concat(results2).Where(r => r != null && r.Score > 0);
|
||||
var maxScore = result.Max(x => x.Score);
|
||||
result = result.Where(x => x.Score > _settings.MinScoreThreshold * maxScore);
|
||||
|
||||
return result.ToList();
|
||||
}
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
|
@ -19,6 +19,8 @@ namespace Microsoft.Plugin.Program
|
||||
|
||||
public bool EnablePathEnvironmentVariableSource { get; set; } = true;
|
||||
|
||||
public double MinScoreThreshold { get; set; } = 0.75;
|
||||
|
||||
internal const char SuffixSeparator = ';';
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user