SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit a17e7ee4 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

fix profiles email search, reverting #2834f395

parent 895c122a
No related branches found
No related tags found
No related merge requests found
......@@ -178,12 +178,12 @@ class ProfileQuerySet(QuerySet):
submission
).filter(has_any_competing_interest_with_submission=False)
def search(self, query):
def search(self, query: str):
"""
Returns all Profiles matching the query for first name, last name, email, or ORCID.
Exact matches are returned first, then partial matches.
"""
terms = query.replace(",", "").replace(".", "").split(" ")
terms = query.replace(",", "").split(" ")
# Get ORCID term.
orcid_term = Q()
......@@ -199,7 +199,8 @@ class ProfileQuerySet(QuerySet):
terms.pop(i) # Remove mail from further processing.
mail_term |= Q(emails__email__icontains=term)
name_terms = terms
# Remove dots from names to allow for matching initials
name_terms = list(map(lambda x: x.replace(".", ""), terms))
base_query = mail_term & orcid_term
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment