Added method to create OR queries from list of strings.

This commit is contained in:
Jorge C. Leitão 2014-05-17 13:21:39 +02:00
parent 99dc011a25
commit 89691ce86a
1 changed files with 7 additions and 0 deletions

View File

@ -1139,6 +1139,13 @@ class XapianSearchQuery(BaseSearchQuery):
return xapian.Query(xapian.Query.OP_AND_NOT, self._all_query(), query)
return query
def _or_query(self, term_list, field, field_type, exact=False):
"""
Joins each item of term_list decorated by _term_query with an OR.
"""
term_list = [self._term_query(term, field, field_type, exact) for term in term_list]
return xapian.Query(xapian.Query.OP_OR, term_list)
def _phrase_query(self, term_list, field_name):
"""
Returns a query that matches exact terms and with