-
Notifications
You must be signed in to change notification settings - Fork 33
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
search: improve with CompositeSuggestQueryParser #151
base: master
Are you sure you want to change the base?
Conversation
ee9e9e7
to
eb1fcfa
Compare
fields=["username^2", "email^2", "profile.full_name^3", "profile.affiliations"], | ||
fields=[ | ||
"username^2", | ||
"email.keyword^2", |
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.
email
had to be changed to email.keyword
for the tests to pass.
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.
Minor: Maybe we could keep the email text field as well, might be useful, wdyt?
"email.keyword^2", | |
"email.keyword^2", | |
"email^2", |
@@ -81,7 +86,6 @@ class UserSearchOptions(SearchOptions, SearchOptionsMixin): | |||
"name": "profile.full_name", | |||
}, | |||
type="most_fields", # https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#multi-match-types | |||
fuzziness="AUTO", # https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#fuzziness |
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.
fuzziness
is applied in CompositeSuggestQueryParser
.
tree_transformer_cls=SearchFieldTransformer, | ||
fields=["username^2", "email^2", "profile.full_name^3", "profile.affiliations"], | ||
fields=[ | ||
"username^2", |
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.
Searching for a username with a dash is still not working well.
For instance, searching from "one-two" seems to search for usernames starting with "one" and starting with "two", and therefore does not find anything.
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 is the issue: text field is split by -
https://github.com/inveniosoftware/invenio-users-resources/blob/master/invenio_users_resources/records/mappings/os-v2/users/user-v3.0.0.json#L132
if you search by username.keyword, it should work
❤️ Thank you for your contribution!
Description
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Frontend
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: