diff --git a/Plugins/Wox.Plugin.ControlPanel/Main.cs b/Plugins/Wox.Plugin.ControlPanel/Main.cs index 340c7b77c..a0e5a3ed6 100644 --- a/Plugins/Wox.Plugin.ControlPanel/Main.cs +++ b/Plugins/Wox.Plugin.ControlPanel/Main.cs @@ -32,14 +32,14 @@ public List Query(Query query) foreach (var item in controlPanelItems) { var titleMatch = StringMatcher.FuzzySearch(query.Search, item.LocalizedString); - var subTitleMatch = StringMatcher.FuzzySearch(query.Search, item.InfoTip); - - item.Score = Math.Max(titleMatch.Score, subTitleMatch.Score); + + item.Score = titleMatch.Score; if (item.Score > 0) { var result = new Result { Title = item.LocalizedString, + TitleHighlightData = titleMatch.MatchData, SubTitle = item.InfoTip, Score = item.Score, IcoPath = item.IconPath, @@ -61,14 +61,7 @@ public List Query(Query query) } }; - if (item.Score == titleMatch.Score) - { - result.TitleHighlightData = titleMatch.MatchData; - } - else - { - result.SubTitleHighlightData = subTitleMatch.MatchData; - } + results.Add(result); } diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 460081d63..83ab6da85 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -267,19 +267,39 @@ public Result Result(string query, IPublicAPI api) Description.Substring(0, DisplayName.Length) == DisplayName) { title = Description; + result.Title = title; + var match = StringMatcher.FuzzySearch(query, title); + result.Score = match.Score; + result.TitleHighlightData = match.MatchData; } else if (!string.IsNullOrEmpty(Description)) { title = $"{DisplayName}: {Description}"; + var match1 = StringMatcher.FuzzySearch(query, DisplayName); + var match2 = StringMatcher.FuzzySearch(query, title); + if (match1.Score > match2.Score) + { + result.Score = match1.Score; + result.TitleHighlightData = match1.MatchData; + } + else + { + result.Score = match2.Score; + result.TitleHighlightData = match2.MatchData; + } + result.Title = title; + } else { title = DisplayName; + result.Title = title; + var match = StringMatcher.FuzzySearch(query, title); + result.Score = match.Score; + result.TitleHighlightData = match.MatchData; } - var match = StringMatcher.FuzzySearch(query, title); - result.Title = title; - result.Score = match.Score; - result.TitleHighlightData = match.MatchData; + + return result; } diff --git a/Plugins/Wox.Plugin.Program/Programs/Win32.cs b/Plugins/Wox.Plugin.Program/Programs/Win32.cs index af6e44a7b..3934d7e5a 100644 --- a/Plugins/Wox.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Wox.Plugin.Program/Programs/Win32.cs @@ -24,7 +24,6 @@ public class Win32 : IProgram public string FullPath { get; set; } public string ParentDirectory { get; set; } public string ExecutableName { get; set; } - public string Description { get; set; } public bool Valid { get; set; } public bool Enabled { get; set; } public string Location => ParentDirectory; @@ -55,21 +54,8 @@ public Result Result(string query, IPublicAPI api) } }; - string title; - if (Description.Length >= Name.Length && Description.Substring(0, Name.Length) == Name) - { - title = Description; - } - else if (!string.IsNullOrEmpty(Description)) - { - title = $"{Name}: {Description}"; - } - else - { - title = Name; - } - var match = StringMatcher.FuzzySearch(query, title); - result.Title = title; + var match = StringMatcher.FuzzySearch(query, Name); + result.Title = Name; result.Score = match.Score; result.TitleHighlightData = match.MatchData; @@ -144,7 +130,6 @@ private static Win32 Win32Program(string path) IcoPath = path, FullPath = path, ParentDirectory = Directory.GetParent(path).FullName, - Description = string.Empty, Valid = true, Enabled = true }; diff --git a/Plugins/Wox.Plugin.Sys/Images/checkupdate.png b/Plugins/Wox.Plugin.Sys/Images/checkupdate.png deleted file mode 100644 index 955f6fdbb..000000000 Binary files a/Plugins/Wox.Plugin.Sys/Images/checkupdate.png and /dev/null differ diff --git a/Plugins/Wox.Plugin.Sys/Images/update.png b/Plugins/Wox.Plugin.Sys/Images/update.png new file mode 100644 index 000000000..6fe579091 Binary files /dev/null and b/Plugins/Wox.Plugin.Sys/Images/update.png differ diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index f6be3a435..7d44cf93e 100644 --- a/Plugins/Wox.Plugin.Sys/Main.cs +++ b/Plugins/Wox.Plugin.Sys/Main.cs @@ -1,3 +1,4 @@ +using NLog; using System; using System.Collections.Generic; using System.Diagnostics; @@ -6,6 +7,7 @@ using System.Windows.Forms; using System.Windows.Interop; using Wox.Infrastructure; +using Wox.Infrastructure.Logger; using Application = System.Windows.Application; using Control = System.Windows.Controls.Control; using FormsApplication = System.Windows.Forms.Application; @@ -44,6 +46,8 @@ private enum HRESULT : uint #endregion + private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); + public Control CreateSettingPanel() { var results = Commands(); @@ -57,20 +61,10 @@ public List Query(Query query) foreach (var c in commands) { var titleMatch = StringMatcher.FuzzySearch(query.Search, c.Title); - var subTitleMatch = StringMatcher.FuzzySearch(query.Search, c.SubTitle); - - var score = Math.Max(titleMatch.Score, subTitleMatch.Score); - if (score > 0) + if (titleMatch.Score > 0) { - c.Score = score; - if (score == titleMatch.Score) - { - c.TitleHighlightData = titleMatch.MatchData; - } - else - { - c.SubTitleHighlightData = subTitleMatch.MatchData; - } + c.Score = titleMatch.Score; + c.TitleHighlightData = titleMatch.MatchData; results.Add(c); } } @@ -237,9 +231,10 @@ private List Commands() }, new Result { + PluginDirectory = context.CurrentPluginMetadata.PluginDirectory, Title = "Check For Update", SubTitle = "Check for new Wox update", - IcoPath = "Images\\checkupdate.png", + IcoPath = "Images\\update.png", Action = c => { Application.Current.MainWindow.Hide(); diff --git a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj index 1145d0882..2d64108d9 100644 --- a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj +++ b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj @@ -67,18 +67,18 @@ - + PreserveNewest - - PreserveNewest - PreserveNewest - + PreserveNewest - + + + PreserveNewest + MSBuild:Compile Designer @@ -144,9 +144,7 @@ PreserveNewest - - - + 10.3.0 diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index 1cd5e971d..42803a4e2 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -207,6 +207,13 @@ public static void UpdatePluginMetadata(List results, PluginMetadata met r.PluginID = metadata.ID; r.OriginQuery = query; + string key = "EmbededIcon:"; + // todo, use icon path type enum in the future + if (!string.IsNullOrEmpty(r.PluginDirectory) && !string.IsNullOrEmpty(r.IcoPath) && !Path.IsPathRooted(r.IcoPath) && !r.IcoPath.StartsWith(key)) + { + r.IcoPath = Path.Combine(r.PluginDirectory, r.IcoPath); + } + // ActionKeywordAssigned is used for constructing MainViewModel's query text auto-complete suggestions // Plugins may have multi-actionkeywords eg. WebSearches. In this scenario it needs to be overriden on the plugin level if (metadata.ActionKeywords.Count == 1) diff --git a/Wox.Infrastructure/FuzzyMatcher.cs b/Wox.Infrastructure/FuzzyMatcher.cs deleted file mode 100644 index 0b69cdf7e..000000000 --- a/Wox.Infrastructure/FuzzyMatcher.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace Wox.Infrastructure -{ - [Obsolete("This class is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")] - public class FuzzyMatcher - { - private string query; - - private FuzzyMatcher(string query) - { - this.query = query.Trim(); - } - - public static FuzzyMatcher Create(string query) - { - return new FuzzyMatcher(query); - } - - public MatchResult Evaluate(string str) - { - return StringMatcher.Instance.FuzzyMatch(query, str); - } - } -} diff --git a/Wox.Infrastructure/StringMatcher.cs b/Wox.Infrastructure/StringMatcher.cs index 8f5588109..6dc43d11c 100644 --- a/Wox.Infrastructure/StringMatcher.cs +++ b/Wox.Infrastructure/StringMatcher.cs @@ -33,18 +33,6 @@ public StringMatcher() public static StringMatcher Instance { get; internal set; } - [Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")] - public static int Score(string source, string target) - { - return FuzzySearch(target, source).Score; - } - - [Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")] - public static bool IsMatch(string source, string target) - { - return Score(source, target) > 0; - } - public static MatchResult FuzzySearch(string query, string stringToCompare) { return Instance.FuzzyMatch(query, stringToCompare); @@ -56,13 +44,14 @@ public MatchResult FuzzyMatch(string query, string stringToCompare) if (string.IsNullOrEmpty(stringToCompare) || string.IsNullOrEmpty(query)) return new MatchResult(false, UserSettingSearchPrecision); var queryWithoutCase = query.ToLower(); string translated = _alphabet.Translate(stringToCompare); - var fullStringToCompareWithoutCase = translated.ToLower(); - - string key = $"{queryWithoutCase}|{fullStringToCompareWithoutCase}"; + + string key = $"{queryWithoutCase}|{translated}"; MatchResult match = _cache[key] as MatchResult; if (match == null) { - match = FuzzyMatchInternal(queryWithoutCase, fullStringToCompareWithoutCase); + match = FuzzyMatchRecurrsive( + queryWithoutCase, translated, 0, 0, new List() + ); CacheItemPolicy policy = new CacheItemPolicy(); policy.SlidingExpiration = new TimeSpan(12, 0, 0); _cache.Set(key, match, policy); @@ -71,167 +60,139 @@ public MatchResult FuzzyMatch(string query, string stringToCompare) return match; } - /// - /// Current method: - /// Character matching + substring matching; - /// 1. Query search string is split into substrings, separator is whitespace. - /// 2. Check each query substring's characters against full compare string, - /// 3. if a character in the substring is matched, loop back to verify the previous character. - /// 4. If previous character also matches, and is the start of the substring, update list. - /// 5. Once the previous character is verified, move on to the next character in the query substring. - /// 6. Move onto the next substring's characters until all substrings are checked. - /// 7. Consider success and move onto scoring if every char or substring without whitespaces matched - /// - public MatchResult FuzzyMatchInternal(string query, string translated) + public MatchResult FuzzyMatchRecurrsive( + string query, string stringToCompare, int queryCurrentIndex, int stringCurrentIndex, List sourceMatchData + ) { - var querySubstrings = query.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - int currentQuerySubstringIndex = 0; - var currentQuerySubstring = querySubstrings[currentQuerySubstringIndex]; - var currentQuerySubstringCharacterIndex = 0; - - var firstMatchIndex = -1; - var firstMatchIndexInWord = -1; - var lastMatchIndex = 0; - bool allQuerySubstringsMatched = false; - bool matchFoundInPreviousLoop = false; - bool allSubstringsContainedInCompareString = true; + if (queryCurrentIndex == query.Length || stringCurrentIndex == stringToCompare.Length) + { + return new MatchResult(false, UserSettingSearchPrecision); + } - var indexList = new List(); + bool recursiveMatch = false; + List bestRecursiveMatchData = new List(); + int bestRecursiveScore = 0; - for (var compareStringIndex = 0; compareStringIndex < translated.Length; compareStringIndex++) + List matchs = new List(); + if (sourceMatchData.Count > 0) { - if (translated[compareStringIndex] != currentQuerySubstring[currentQuerySubstringCharacterIndex]) - { - matchFoundInPreviousLoop = false; - continue; - } - - if (firstMatchIndex < 0) + foreach (var data in sourceMatchData) { - // first matched char will become the start of the compared string - firstMatchIndex = compareStringIndex; + matchs.Add(data); } + } - if (currentQuerySubstringCharacterIndex == 0) - { - // first letter of current word - matchFoundInPreviousLoop = true; - firstMatchIndexInWord = compareStringIndex; - } - else if (!matchFoundInPreviousLoop) + while (queryCurrentIndex < query.Length && stringCurrentIndex < stringToCompare.Length) + { + char queryLower = char.ToLower(query[queryCurrentIndex]); + char stringToCompareLower = char.ToLower(stringToCompare[stringCurrentIndex]); + if (queryLower == stringToCompareLower) { - // we want to verify that there is not a better match if this is not a full word - // in order to do so we need to verify all previous chars are part of the pattern - var startIndexToVerify = compareStringIndex - currentQuerySubstringCharacterIndex; + MatchResult match = FuzzyMatchRecurrsive( + query, stringToCompare, queryCurrentIndex, stringCurrentIndex + 1, matchs + ); - if (AllPreviousCharsMatched(startIndexToVerify, currentQuerySubstringCharacterIndex, translated, currentQuerySubstring)) + if (match.Success) { - matchFoundInPreviousLoop = true; - - // if it's the beginning character of the first query substring that is matched then we need to update start index - firstMatchIndex = currentQuerySubstringIndex == 0 ? startIndexToVerify : firstMatchIndex; - - indexList = GetUpdatedIndexList(startIndexToVerify, currentQuerySubstringCharacterIndex, firstMatchIndexInWord, indexList); + if (!recursiveMatch || match.RawScore > bestRecursiveScore) + { + bestRecursiveMatchData = new List(); + foreach (int data in match.MatchData) + { + bestRecursiveMatchData.Add(data); + } + bestRecursiveScore = match.Score; + } + recursiveMatch = true; } - } - - lastMatchIndex = compareStringIndex + 1; - indexList.Add(compareStringIndex); - - currentQuerySubstringCharacterIndex++; - - // if finished looping through every character in the current substring - if (currentQuerySubstringCharacterIndex == currentQuerySubstring.Length) - { - // if any of the substrings was not matched then consider as all are not matched - allSubstringsContainedInCompareString = matchFoundInPreviousLoop && allSubstringsContainedInCompareString; - - currentQuerySubstringIndex++; - - allQuerySubstringsMatched = AllQuerySubstringsMatched(currentQuerySubstringIndex, querySubstrings.Length); - if (allQuerySubstringsMatched) - break; - - // otherwise move to the next query substring - currentQuerySubstring = querySubstrings[currentQuerySubstringIndex]; - currentQuerySubstringCharacterIndex = 0; + matchs.Add(stringCurrentIndex); + queryCurrentIndex += 1; } + stringCurrentIndex += 1; } - // proceed to calculate score if every char or substring without whitespaces matched - if (allQuerySubstringsMatched) + bool matched = queryCurrentIndex == query.Length; + int outScore; + if (matched) { - var score = CalculateSearchScore(query, translated, firstMatchIndex, lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString); + outScore = 100; + int penality = 3 * matchs[0]; + outScore = outScore - penality; - return new MatchResult(true, UserSettingSearchPrecision, indexList, score); - } + int unmatched = stringToCompare.Length - matchs.Count; + outScore = outScore - (5 * unmatched); - return new MatchResult(false, UserSettingSearchPrecision); - } - - private static bool AllPreviousCharsMatched(int startIndexToVerify, int currentQuerySubstringCharacterIndex, - string fullStringToCompareWithoutCase, string currentQuerySubstring) - { - var allMatch = true; - for (int indexToCheck = 0; indexToCheck < currentQuerySubstringCharacterIndex; indexToCheck++) - { - if (fullStringToCompareWithoutCase[startIndexToVerify + indexToCheck] != - currentQuerySubstring[indexToCheck]) + int consecutiveMatch = 0; + for (int i = 0; i < matchs.Count; i++) { - allMatch = false; + int indexCurent = matchs[i]; + if (i > 0) + { + int indexPrevious = matchs[i - 1]; + if (indexCurent == indexPrevious + 1) + { + consecutiveMatch += 1; + outScore += 10 * consecutiveMatch; + } else + { + consecutiveMatch = 0; + } + } + + char current = stringToCompare[indexCurent]; + bool currentUpper = char.IsUpper(current); + if (indexCurent > 0) + { + char neighbor = stringToCompare[indexCurent - 1]; + if (currentUpper && char.IsLower(neighbor)) + { + outScore += 30; + } + + bool isNeighbourSeparator = neighbor == '_' || neighbor == ' '; + if (isNeighbourSeparator) + { + outScore += 50; + if (currentUpper) + { + outScore += 50; + } + } + } + else + { + outScore += 50; + if (currentUpper) + { + outScore += 50; + } + } } } - - return allMatch; - } - - private static List GetUpdatedIndexList(int startIndexToVerify, int currentQuerySubstringCharacterIndex, int firstMatchIndexInWord, List indexList) - { - var updatedList = new List(); - - indexList.RemoveAll(x => x >= firstMatchIndexInWord); - - updatedList.AddRange(indexList); - - for (int indexToCheck = 0; indexToCheck < currentQuerySubstringCharacterIndex; indexToCheck++) + else { - updatedList.Add(startIndexToVerify + indexToCheck); + outScore = 0; } - return updatedList; - } - - private static bool AllQuerySubstringsMatched(int currentQuerySubstringIndex, int querySubstringsLength) - { - return currentQuerySubstringIndex >= querySubstringsLength; - } - - private static int CalculateSearchScore(string query, string stringToCompare, int firstIndex, int matchLen, bool allSubstringsContainedInCompareString) - { - // A match found near the beginning of a string is scored more than a match found near the end - // A match is scored more if the characters in the patterns are closer to each other, - // while the score is lower if they are more spread out - var score = 100 * (query.Length + 1) / ((1 + firstIndex) + (matchLen + 1)); - - // A match with less characters assigning more weights - if (stringToCompare.Length - query.Length < 5) + if (recursiveMatch && (!matched || bestRecursiveScore > outScore)) { - score += 20; + matchs = new List(); + foreach (int data in bestRecursiveMatchData) + { + matchs.Add(data); + } + outScore = bestRecursiveScore; + return new MatchResult(true, UserSettingSearchPrecision, matchs, outScore); } - else if (stringToCompare.Length - query.Length < 10) + else if (matched) { - score += 10; + return new MatchResult(true, UserSettingSearchPrecision, matchs, outScore); } - - if (allSubstringsContainedInCompareString) + else { - int count = query.Count(c => !char.IsWhiteSpace(c)); - int factor = count < 4 ? 10 : 5; - score += factor * count; + return new MatchResult(false, UserSettingSearchPrecision); } - - return score; } public enum SearchPrecisionScore diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 6c86d70ae..e69e45a85 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -65,7 +65,6 @@ - diff --git a/Wox.Plugin/Result.cs b/Wox.Plugin/Result.cs index 1d97ae82b..bac705abc 100644 --- a/Wox.Plugin/Result.cs +++ b/Wox.Plugin/Result.cs @@ -20,23 +20,7 @@ public class Result : BaseModel /// public string ActionKeywordAssigned { get; set; } - public string IcoPath - { - get { return _icoPath; } - set - { - // todo, use icon path type enum in the future - string key = "EmbededIcon:"; - if (!string.IsNullOrEmpty(PluginDirectory) && !Path.IsPathRooted(value) && !value.StartsWith(key)) - { - _icoPath = Path.Combine(PluginDirectory, value); - } - else - { - _icoPath = value; - } - } - } + public string IcoPath { get; set; } public delegate ImageSource IconDelegate(); diff --git a/Wox.Test/FuzzyMatcherTest.cs b/Wox.Test/FuzzyMatcherTest.cs index cd6f08cce..66d73ca09 100644 --- a/Wox.Test/FuzzyMatcherTest.cs +++ b/Wox.Test/FuzzyMatcherTest.cs @@ -129,33 +129,24 @@ public void WhenGivenStringsAndAppliedPrecisionFilteringThenShouldReturnGreaterT } } - [TestCase(Chrome, Chrome, 137)] - [TestCase(Chrome, LastIsChrome, 83)] - [TestCase(Chrome, HelpCureHopeRaiseOnMindEntityChrome, 21)] - [TestCase(Chrome, UninstallOrChangeProgramsOnYourComputer, 15)] - [TestCase(Chrome, CandyCrushSagaFromKing, 0)] - [TestCase("sql", MicrosoftSqlServerManagementStudio, 56)] - [TestCase("sql manag", MicrosoftSqlServerManagementStudio, 79)]//double spacing intended - public void WhenGivenQueryStringThenShouldReturnCurrentScoring(string queryString, string compareString, int expectedScore) - { - // When, Given - var matcher = new StringMatcher(); - var rawScore = matcher.FuzzyMatch(queryString, compareString).RawScore; - - // Should - Assert.AreEqual(expectedScore, rawScore, $"Expected score for compare string '{compareString}': {expectedScore}, Actual: {rawScore}"); - } - + [TestCase("setti", "Settings", StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("vs19", "Visual Studio 2019", StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("vs2019", "Visual Studio 2019", StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("vsc", "Visual Studio Code", StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase(Chrome, Chrome, StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase(Chrome, LastIsChrome, StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase(Chrome, HelpCureHopeRaiseOnMindEntityChrome, StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase(Chrome, UninstallOrChangeProgramsOnYourComputer, StringMatcher.SearchPrecisionScore.Regular, false)] + [TestCase(Chrome, CandyCrushSagaFromKing, StringMatcher.SearchPrecisionScore.Regular, false)] + [TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] + [TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("goo", "Google Chrome", StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("chr", "Google Chrome", StringMatcher.SearchPrecisionScore.Low, true)] [TestCase("chr", "Chrome", StringMatcher.SearchPrecisionScore.Regular, true)] - [TestCase("chr", "Help cure hope raise on mind entity Chrome", StringMatcher.SearchPrecisionScore.Regular, false)] - [TestCase("chr", "Help cure hope raise on mind entity Chrome", StringMatcher.SearchPrecisionScore.Low, true)] - [TestCase("chr", "Candy Crush Saga from King", StringMatcher.SearchPrecisionScore.Regular, false)] + [TestCase("chr", "Help cure hope raise on mind entity Chrome", StringMatcher.SearchPrecisionScore.Low, true)] [TestCase("chr", "Candy Crush Saga from King", StringMatcher.SearchPrecisionScore.None, true)] [TestCase("ccs", "Candy Crush Saga from King", StringMatcher.SearchPrecisionScore.Low, true)] [TestCase("cand", "Candy Crush Saga from King", StringMatcher.SearchPrecisionScore.Regular, true)] - [TestCase("cand", "Help cure hope raise on mind entity Chrome", StringMatcher.SearchPrecisionScore.Regular, false)] public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual( string queryString, string compareString, @@ -184,22 +175,20 @@ public void WhenGivenQueryStringThenShouldReturnCurrentScoring(string queryStrin } [TestCase("exce", "OverLeaf-Latex: An online LaTeX editor", StringMatcher.SearchPrecisionScore.Regular, false)] - [TestCase("term", "Windows Terminal (Preview)", StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("term", "Windows Terminal", StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("sql s managa", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] [TestCase("sql' s manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] [TestCase("sql s manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] - [TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] [TestCase("sql serv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] - [TestCase("sqlserv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] - [TestCase("sql servman", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] + [TestCase("sqlserv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("sql servman", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("sql serv man", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("sql studio", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("mic", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("chr", "Shutdown", StringMatcher.SearchPrecisionScore.Regular, false)] - [TestCase("mssms", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] - [TestCase("chr", "Change settings for text-to-speech and for speech recognition (if installed).", StringMatcher.SearchPrecisionScore.Regular, false)] - [TestCase("ch r", "Change settings for text-to-speech and for speech recognition (if installed).", StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("mssms", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("a test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)] public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings( diff --git a/Wox.Test/PluginProgramTest.cs b/Wox.Test/PluginProgramTest.cs index 28ed34d5a..a57f45220 100644 --- a/Wox.Test/PluginProgramTest.cs +++ b/Wox.Test/PluginProgramTest.cs @@ -38,7 +38,7 @@ public void Setup() }); } - [TestCase("powershell", "PowerShell")] + //[TestCase("powershell", "Windows PowerShell")] skip for appveyror [TestCase("note", "Notepad")] [TestCase("computer", "computer")] public void Win32Test(string QueryText, string ResultTitle) diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index d11c278af..79c9b919e 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -753,7 +753,7 @@ public void UpdateResultView(List updates) } else if (!update.Metadata.KeepResultRawScore) { - result.Score += _userSelectedRecord.GetSelectedCount(result) * 5; + result.Score += _userSelectedRecord.GetSelectedCount(result) * 10; } else {