mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-03-16 22:20:31 +00:00
Refactored _filter_exact query constructor.
Its interface is explained in the docstring.
This commit is contained in:
parent
83d10b6cc1
commit
2969a74953
1 changed files with 7 additions and 11 deletions
|
|
@ -1121,18 +1121,14 @@ class XapianSearchQuery(BaseSearchQuery):
|
|||
|
||||
def _filter_exact(self, term, field_name, field_type, is_not):
|
||||
"""
|
||||
Private method that returns a xapian.Query that searches for an exact
|
||||
match for `term` in a specified `field`.
|
||||
|
||||
Required arguments:
|
||||
``term`` -- The term to search for
|
||||
``field`` -- The field to search
|
||||
``is_not`` -- Invert the search results
|
||||
|
||||
Returns:
|
||||
A xapian.Query
|
||||
Returns a query that matches exactly the un-stemmed term
|
||||
with positional order.
|
||||
"""
|
||||
query = self._phrase_query(term.split(), field_name)
|
||||
if ' ' in term:
|
||||
query = self._phrase_query(term.split(), field_name)
|
||||
else:
|
||||
query = self._term_query(term, field_name, field_type, exact=True)
|
||||
|
||||
if is_not:
|
||||
return xapian.Query(xapian.Query.OP_AND_NOT, self._all_query(), query)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue