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