From e1d1331185c23aa95ef70eb92a084c402113578f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 29 Sep 2022 16:06:07 +0530 Subject: Support prefix search and range queries. * wqflask/wqflask/gsearch.py (GSearch.__init__): Support prefix search and range queries. --- wqflask/wqflask/gsearch.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'wqflask') 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 -- cgit v1.2.3