From c3dfa0029975d73ba8f6105c911ea2f2ef3a563d Mon Sep 17 00:00:00 2001 From: Jake Rosenberg Date: Tue, 10 Dec 2024 11:44:37 -0600 Subject: [PATCH] Fix case bug in project metadata search (#1001) Co-authored-by: Shayan Khan --- server/portal/apps/projects/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/portal/apps/projects/views.py b/server/portal/apps/projects/views.py index e1ac3d179..e5b6246c1 100644 --- a/server/portal/apps/projects/views.py +++ b/server/portal/apps/projects/views.py @@ -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))