From 42c97bdca1d54d12a7e0f46f854ef0321ed2ec49 Mon Sep 17 00:00:00 2001 From: zsloan Date: Sat, 20 Jul 2024 16:04:23 +0000 Subject: Also address the issue with trait IDs being detected as substrings for searches including the group codes, like BXD_27538 --- gn2/wqflask/do_search.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gn2/wqflask/do_search.py b/gn2/wqflask/do_search.py index a40614db..b64c6fce 100644 --- a/gn2/wqflask/do_search.py +++ b/gn2/wqflask/do_search.py @@ -253,15 +253,15 @@ class PhenotypeSearch(DoSearch): # Todo: Zach will figure out exactly what both these lines mean # and comment here - # if "'" not in self.search_term[0]: search_term = self.search_term[0] - if not self.search_term[0].isnumeric() or len(self.search_term[0]) != 5: # To make sure phenotype trait IDs aren't included in a fulltext search - search_term = "%" + \ - self.handle_wildcard(self.search_term[0]) + "%" if "_" in self.search_term[0]: if len(self.search_term[0].split("_")[0]) == 3: - search_term = "%" + self.handle_wildcard( - self.search_term[0].split("_")[1]) + "%" + search_term = self.search_term[0].split("_")[1] + + if not search_term.isnumeric() or len(search_term) != 5: # To make sure phenotype trait IDs aren't included in a fulltext search + search_term = "%" + \ + self.handle_wildcard(search_term) + "%" + # This adds a clause to the query that matches the search term # against each field in the search_fields tuple -- cgit v1.2.3