-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Training search #2151
Training search #2151
Conversation
As I think about this more, I'm not entirely pleased with this approach (not just this PR but the original approach) as if someone has a space in their personal or family names, this will not work. For example, searching for Mary Ann will not return the person named Mary Ann Smith. |
@maneesha I'm okay with your changes. @maneesha @fmichonneau I also conducted some testing of PostgreSQL's Full Text Search. persons = list(
Person.objects.annotate(
name_search=SearchVector('personal', 'middle', 'family')
).filter(
Q(name_search=term)
| Q(email__icontains=term)
| Q(secondary_email__icontains=term)
| Q(github__icontains=term)
).order_by("family")
) Diff: This code also solves for the case you mentioned ( There's a caveat though. In some cases the results would not contain the same set of people as previously. Here's search results for term @maneesha @fmichonneau Please let me know if you would like to switch to Full Text Search. |
What is the logic that causes I don't see deep explanation in the SearchVector documentation. |
@maneesha I don't know why |
It seems illogical to me that If that's not the case, then I don't like this approach as the logic doesn't make sense. |
On a call today we agreed with @maneesha to not use full-text search for this kind of searching. |
Adds functionality to search trainees by personal and family name together. This does add some slightly redundant code, but only twice. We can consider refactoring if needed.
Addresses #2149