Skip to content
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

fix: generalizes player search query format #249

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

abaisero
Copy link
Contributor

@abaisero abaisero commented Apr 5, 2022

Prior to this commit, the search query was used monolithically as a
single string to match the members' member id or their (comma-separated)
full name; this had many shortcomings, e.g., a search query " 12345 "
would fail to match a member with id "12345", and a search query
"surname name" would fail to match a member with full name "surname,
name". Also see #164 and #248.

In this commit, the search is first stripped of outer whitespace, which
helps search for member ids. If the search query is not an id, then the
search query is split into tokens, and a match with a member is found if
all of the respective query tokens match the member's full name. This
allows users to run queries such as "name", "surname", "name surname" or
"surname name".

Prior to this commit, the search query was used monolithically as a
single string to match the members' member id or their (comma-separated)
full name;  this had many shortcomings, e.g., a search query " 12345 "
would fail to match a member with id "12345", and a search query
"surname name" would fail to match a member with full name "surname,
name".  Also see usgo#164 and usgo#248.

In this commit, the search is first stripped of outer whitespace, which
helps search for member ids.  If the search query is not an id, then the
search query is split into tokens, and a match with a member is found if
all of the respective query tokens match the member's full name.  This
allows users to run queries such as "name", "surname", "name surname" or
"surname name".
@abaisero abaisero requested a review from a team as a code owner April 5, 2022 05:45
@abaisero
Copy link
Contributor Author

abaisero commented Apr 5, 2022

Seems like the black checker failed, which is a bit ironic, considering I do use black, but opted not to use it for this pull-request because the file was not black-compliant to start with.. I'll wait for further feedback before addressing black compliance.

@michaelhiiva
Copy link
Contributor

@abaisero Just letting you know that I have seen this request, and I will be working on taking some time aside to look at it.

If you are interested in getting more involved in our projects and chatting more, you can email us at either webmaster@usgo.org. If you do drop an email, please tell us a little about yourself and what got you interested in our projects.

Copy link
Member

@amj amj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This has been on the list for a while. Thanks!

@amj amj merged commit b70a668 into usgo:main Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants