aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorArun Isaac2022-09-29 16:06:07 +0530
committerArun Isaac2022-09-29 16:15:48 +0530
commite1d1331185c23aa95ef70eb92a084c402113578f (patch)
treee2ba816bf3caf0f581637fdcceacfb226e71f1cc /wqflask
parentef17e6b57b267922ad0af2423e5d6d523458c8ed (diff)
downloadgenenetwork2-e1d1331185c23aa95ef70eb92a084c402113578f.tar.gz
Support prefix search and range queries.
* wqflask/wqflask/gsearch.py (GSearch.__init__): Support prefix search and range queries.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/gsearch.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 17c6c519..f2ee1826 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -38,6 +38,17 @@ class GSearch:
queryparser = xapian.QueryParser()
queryparser.set_stemmer(xapian.Stem("en"))
queryparser.set_stemming_strategy(queryparser.STEM_SOME)
+ queryparser.add_prefix("author", "A")
+ queryparser.add_prefix("species", "XS")
+ queryparser.add_prefix("group", "XG")
+ queryparser.add_prefix("tissue", "XI")
+ queryparser.add_prefix("description", "XD")
+ queryparser.add_prefix("dataset", "XDS")
+ queryparser.add_prefix("symbol", "XY")
+ queryparser.add_prefix("chr", "XC")
+ queryparser.add_prefix("peakchr", "XPC")
+ for i, prefix in enumerate(["mean:", "peak:", "mb:", "peakmb:", "additive:", "year:"]):
+ queryparser.add_rangeprocessor(xapian.NumberRangeProcessor(i, prefix))
querystring = self.terms
query = queryparser.parse_query(querystring)
# FIXME: Handle presentation (that is, formatting strings for