-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Added boost for matches directly following the last period #708
Conversation
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.
I think this PR solves this problem:
This makes a match for MyModule.Structs.User take precedence over MyModule.User.Something while querying for User
but it doesn't address the issue with mixed case. Instead, it pushes modules with capital letters further down. The screenshot illustrates the problem; the module with 'User' at the top is sorted towards the end.
You can also reproduce the issue with this unit test:
test "matches when there're mixed case characters" do
results = score_and_sort(~w(create_user save_user Demo.Accounts.User), "User")
assert results == ~w(Demo.Accounts.User create_user save_user)
end
@scottming i made some changes to the scoring that should improve the situations you've mentioned. |
apps/remote_control/test/lexical/remote_control/search/fuzzy/scorer_test.exs
Outdated
Show resolved
Hide resolved
apps/remote_control/lib/lexical/remote_control/search/fuzzy/scorer.ex
Outdated
Show resolved
Hide resolved
462cbb3
to
1b1b469
Compare
If something matches starting after the last period (of a likely module) it is boosted. This makes a match for `MyModule.Structs.User` take precedence over `MyModule.User.Something` while querying for `User`
* Removed case match bonus in favor of camel case bonus * Removed pattern length bonus, since it's the same for all subjects * Changed incompleteness penalty to be based on the number of characters matched in the subject rather than the size of the pattern
1b1b469
to
01d9f11
Compare
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.
I tested it and I think the latest version works really well, thank you. I believe that boosting the last module is extremely effective because once we pinpoint the module, we can narrow the scope and more quickly locate the specific symbol.
* Added boost for matches directly following the last period If something matches starting after the last period (of a likely module) it is boosted. This makes a match for `MyModule.Structs.User` take precedence over `MyModule.User.Something` while querying for `User` * Simplified scoring rules * Removed case match bonus in favor of camel case bonus * Removed pattern length bonus, since it's the same for all subjects * Changed incompleteness penalty to be based on the number of characters matched in the subject rather than the size of the pattern * dropped min query length to 1
If something matches starting after the last period (of a likely module) it is boosted. This makes a match for
MyModule.Structs.User
take precedence overMyModule.User.Something
while querying forUser