mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
#129 exclude system plugins results when searching websearch.
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Wox.Plugin.SystemPlugins.Program
|
|||||||
|
|
||||||
protected override List<Result> QueryInternal(Query query)
|
protected override List<Result> QueryInternal(Query query)
|
||||||
{
|
{
|
||||||
if (query.RawQuery.Length <= 1) return new List<Result>();
|
if (query.RawQuery.Trim().Length <= 1) return new List<Result>();
|
||||||
|
|
||||||
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
|
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
|
||||||
List<Program> returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();
|
List<Program> returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Wox.Infrastructure.Storage.UserSettings;
|
using Wox.Infrastructure.Storage.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
using Wox.Plugin.SystemPlugins;
|
||||||
using Wox.PluginLoader;
|
using Wox.PluginLoader;
|
||||||
|
|
||||||
namespace Wox.Commands
|
namespace Wox.Commands
|
||||||
@@ -13,16 +14,25 @@ namespace Wox.Commands
|
|||||||
{
|
{
|
||||||
public override void Dispatch(Query query)
|
public override void Dispatch(Query query)
|
||||||
{
|
{
|
||||||
foreach (PluginPair pair in Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System))
|
var allSytemPlugins = Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System);
|
||||||
|
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == query.ActionName && o.Enabled))
|
||||||
|
{
|
||||||
|
//websearch mode
|
||||||
|
allSytemPlugins = new List<PluginPair>()
|
||||||
|
{
|
||||||
|
allSytemPlugins.First(o => ((ISystemPlugin)o.Plugin).ID == "565B73353DBF4806919830B9202EE3BF")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (PluginPair pair in allSytemPlugins)
|
||||||
{
|
{
|
||||||
PluginPair pair1 = pair;
|
PluginPair pair1 = pair;
|
||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(state =>
|
ThreadPool.QueueUserWorkItem(state =>
|
||||||
{
|
{
|
||||||
List<Result> results = pair1.Plugin.Query(query);
|
List<Result> results = pair1.Plugin.Query(query);
|
||||||
results.ForEach(o=> { o.AutoAjustScore = true; });
|
results.ForEach(o => { o.AutoAjustScore = true; });
|
||||||
|
|
||||||
App.Window.PushResults(query,pair1.Metadata,results);
|
App.Window.PushResults(query, pair1.Metadata, results);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user