diff options
author | zsloan | 2015-06-02 22:04:48 +0000 |
---|---|---|
committer | zsloan | 2015-06-02 22:04:48 +0000 |
commit | 97a4c1951cf92a9b1f4151953439a6dc3119da5f (patch) | |
tree | 5ece82a14e330f1370ff11703b01055dc1bc3f9c /wqflask | |
parent | a3cea36d16ec20a6fb5b4e9073e34b2adff0c3dd (diff) | |
download | genenetwork2-97a4c1951cf92a9b1f4151953439a6dc3119da5f.tar.gz |
Wildcards can now be appended to mRNA assay searches, but isn't working correctly yet with phenotypes
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/wqflask/do_search.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index f6f39ab0..529befb4 100755 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -3,6 +3,8 @@ from __future__ import print_function, division +import string + from flask import Flask, g from MySQLdb import escape_string as escape @@ -40,6 +42,13 @@ class DoSearch(object): results = g.db.execute(query, no_parameters=True).fetchall() return results + def handle_wildcard(self, str): + keyword = str.strip() + keyword.replace("*",".*") + keyword.replace("?",".") + + return keyword + #def escape(self, stringy): # """Shorter name than self.db_conn.escape_string""" # return escape(str(stringy)) @@ -237,7 +246,7 @@ 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] + "[[:>:]]" + search_term = "[[:<:]]" + self.handle_wildcard(self.search_term[0]) + "[[:>:]]" # This adds a clause to the query that matches the search term # against each field in the search_fields tuple |