Skip to content

Commit

Permalink
Fix case bug in project metadata search (#1001)
Browse files Browse the repository at this point in the history
Co-authored-by: Shayan Khan <[email protected]>
  • Loading branch information
jarosenb and shayanaijaz authored Dec 10, 2024
1 parent 271ce8c commit c3dfa00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/portal/apps/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def get(self, request, root_system=None):
if query_string:
search = IndexedProject.search()

ngram_query = Q("query_string", query=query_string,
ngram_query = Q("query_string", query=query_string.lower(),
fields=["title", "id"],
minimum_should_match='100%',
default_operator='or')

wildcard_query = Q("wildcard", title=f'*{query_string}*') | Q("wildcard", id=f'*{query_string}*')
wildcard_query = Q("wildcard", title=f'*{query_string.lower()}*') | Q("wildcard", id=f'*{query_string.lower()}*')

search = search.query(ngram_query | wildcard_query)
search = search.extra(from_=int(offset), size=int(limit))
Expand Down

0 comments on commit c3dfa00

Please sign in to comment.