-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[launcher] - Increase the score for Exact matches in the Name of the Application #3213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[launcher] - Increase the score for Exact matches in the Name of the Application #3213
Conversation
| } | ||
| } | ||
|
|
||
| // To increase the score of an exact match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It would be better to use a variable or constant here to have self documenting code. eg.
var bonusForExactMatch = 10;
score += bonusForExactMatch;
| { | ||
| // When, Given | ||
| // Arrange | ||
| string queryString = "vim"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be data driven for other test cases.
eg.
[TestCase("vim", "vim", "ignoreDescription", "ignore.exe", "vim diff", "ignoreDescription", "ignore.exe")]
public void WhenMultipleResults_NameWithExactMatch_ShouldHaveGreatestScore(string query, string firstName, string firstDescription, string firstExecutableName, string secondName, string secondDescription, string secondExecutableName);
| var secondExecutableNameMatch = matcher.FuzzyMatch(queryString, secondExecutableName).RawScore; | ||
|
|
||
| var firstScore = new[] { firstNameMatch, firstDescriptionMatch, firstExecutableNameMatch }.Max(); | ||
| var secondScore = new[] { secondNameMatch, secondDescriptionMatch, secondExecutableNameMatch }.Max(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clarification] DescriptionMatch, ExecutableNameMatch will have the same score in both first and second cases and would be ignored by the max operation. Is it required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. The reason I did it is to emulate the way scoring is done in the code for Win32 Applications. Rather than just comparing the names, which have the max value, I also wanted to show that even though the exe has the same name as the query string, it would still order the results correctly and not affect the scoring, ie. the one with the exact match would have a higher score. However, for clarity, I shall rename it to ignore.exe as suggested by Ryan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!! Thanks!
Summary of the Pull Request
vim,Vim Diffwas showing up as the first result and instead ofVim.vim.exeall the results were getting the same score.PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed