mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
update allSubstringsContainedInCompareString calculation as per comment
This commit is contained in:
parent
71d8c2080c
commit
592f1cafdb
2 changed files with 8 additions and 4 deletions
|
|
@ -210,7 +210,11 @@ namespace Wox.Infrastructure
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allSubstringsContainedInCompareString)
|
if (allSubstringsContainedInCompareString)
|
||||||
score += 10 * string.Concat(query.Where(c => !char.IsWhiteSpace(c))).Count();
|
{
|
||||||
|
int count = query.Count(c => !char.IsWhiteSpace(c));
|
||||||
|
int factor = count < 4 ? 10 : 5;
|
||||||
|
score += factor * count;
|
||||||
|
}
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,13 +121,13 @@ namespace Wox.Test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(Chrome, Chrome, 167)]
|
[TestCase(Chrome, Chrome, 137)]
|
||||||
[TestCase(Chrome, LastIsChrome, 113)]
|
[TestCase(Chrome, LastIsChrome, 83)]
|
||||||
[TestCase(Chrome, HelpCureHopeRaiseOnMindEntityChrome, 21)]
|
[TestCase(Chrome, HelpCureHopeRaiseOnMindEntityChrome, 21)]
|
||||||
[TestCase(Chrome, UninstallOrChangeProgramsOnYourComputer, 15)]
|
[TestCase(Chrome, UninstallOrChangeProgramsOnYourComputer, 15)]
|
||||||
[TestCase(Chrome, CandyCrushSagaFromKing, 0)]
|
[TestCase(Chrome, CandyCrushSagaFromKing, 0)]
|
||||||
[TestCase("sql", MicrosoftSqlServerManagementStudio, 56)]
|
[TestCase("sql", MicrosoftSqlServerManagementStudio, 56)]
|
||||||
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, 119)]//double spacing intended
|
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, 79)]//double spacing intended
|
||||||
public void WhenGivenQueryStringThenShouldReturnCurrentScoring(string queryString, string compareString, int expectedScore)
|
public void WhenGivenQueryStringThenShouldReturnCurrentScoring(string queryString, string compareString, int expectedScore)
|
||||||
{
|
{
|
||||||
// When, Given
|
// When, Given
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue