From 1bbf80ac9ff7f28409c1469070bc2e66df74899e Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 1 Oct 2019 11:33:35 -0500 Subject: Changed alias search to only search aliases in symbol field Fixed issue where authors sometimes weren't encoded correctly for global search --- wqflask/wqflask/do_search.py | 19 +++++++++++-------- wqflask/wqflask/templates/gsearch_pheno.html | 11 +++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index e0f4eb17..a7f117ec 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -109,23 +109,26 @@ class MrnaAssaySearch(DoSearch): 'Additive Effect'] def get_where_clause(self): - - aliases = get_aliases(escape(self.search_term[0]), self.dataset.group.species) - if len(aliases) > 0: - search_string = " ".join(aliases) - else: - search_string = escape(self.search_term[0]) + search_string = escape(self.search_term[0]) if self.search_term[0] != "*": - match_clause = """(MATCH (ProbeSet.Name, + match_clause = """((MATCH (ProbeSet.Name, ProbeSet.description, ProbeSet.symbol, alias, GenbankId, UniGeneId, Probe_Target_Description) - AGAINST ('%s' IN BOOLEAN MODE)) and + AGAINST ('%s' IN BOOLEAN MODE)) """ % (search_string) + + aliases = get_aliases(search_string, self.dataset.group.species) + if len(aliases) > 0: + match_clause += " or " + alias_string = " ".join(aliases) + match_clause += "(MATCH (ProbeSet.symbol) AGAINST ('%s' IN BOOLEAN MODE))) and " % alias_string + else: + match_clause += ") and " else: match_clause = "" diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 4e142846..c626a589 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -184,10 +184,17 @@ 'render': function(data, type, row, meta) { author_list = data.authors.split(",") if (author_list.length >= 6) { - return author_list.slice(0, 6).join(",") + ", et al." + author_string = author_list.slice(0, 6).join(",") + ", et al." } else{ - return data.authors + author_string = data.authors } + + try { + return decodeURIComponent(escape(author_string)) + } catch(err) { + return author_string + } + } }, { -- cgit v1.2.3