aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/do_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/wqflask/do_search.py')
-rwxr-xr-xwqflask/wqflask/do_search.py11
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