diff --git a/Wox.Infrastructure/StringMatcher.cs b/Wox.Infrastructure/StringMatcher.cs index 5d5a9b9a8c..d1cc1fdecb 100644 --- a/Wox.Infrastructure/StringMatcher.cs +++ b/Wox.Infrastructure/StringMatcher.cs @@ -145,8 +145,7 @@ namespace Wox.Infrastructure { Success = true, MatchData = indexList, - RawScore = Math.Max(score, pinyinScore), - AllSubstringsContainedInCompareString = allSubstringsContainedInCompareString + RawScore = Math.Max(score, pinyinScore) }; return result; @@ -283,11 +282,6 @@ namespace Wox.Infrastructure } } - /// - /// Indicates if all query's substrings are contained in the string to compare - /// - public bool AllSubstringsContainedInCompareString { get; set; } - /// /// Matched data to highlight. /// diff --git a/Wox.Test/FuzzyMatcherTest.cs b/Wox.Test/FuzzyMatcherTest.cs index b7e0374f04..f2de39a289 100644 --- a/Wox.Test/FuzzyMatcherTest.cs +++ b/Wox.Test/FuzzyMatcherTest.cs @@ -182,10 +182,15 @@ namespace Wox.Test [TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("sql serv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)] + [TestCase("sqlserv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] + [TestCase("sql servman", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)] + [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("a test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)] [TestCase("test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)] public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings( @@ -214,21 +219,5 @@ namespace Wox.Test $"Raw Score: {matchResult.RawScore}{Environment.NewLine}" + $"Precision Score: {(int)expectedPrecisionScore}"); } - - [TestCase("sql servman", MicrosoftSqlServerManagementStudio, false)] - [TestCase("sql serv man", MicrosoftSqlServerManagementStudio, true)] - [TestCase("sql", MicrosoftSqlServerManagementStudio, true)] - [TestCase("sqlserv", MicrosoftSqlServerManagementStudio, false)] - [TestCase("mssms", MicrosoftSqlServerManagementStudio, false)] - [TestCase("chr", "Change settings for text-to-speech and for speech recognition (if installed).", false)] - [TestCase("ch r", "Change settings for text-to-speech and for speech recognition (if installed).", true)] - public void WhenGivenQueryShouldEvaluateTrueFalseIfCompareStringContainsAllSubstrings(string queryString, string compareString, bool expectedResult) - { - // When, Given - var matchResult = StringMatcher.FuzzySearch(queryString, compareString).AllSubstringsContainedInCompareString; - - // Should - Assert.AreEqual(matchResult, expectedResult); - } } } \ No newline at end of file