mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-04-24 00:24:51 +00:00
Fixed #101 - Adds support to AutoQuery.
This commit is contained in:
parent
4d51f5e9af
commit
5d16d1aca7
1 changed files with 10 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ from haystack import connections
|
|||
from haystack.backends import BaseEngine, BaseSearchBackend, BaseSearchQuery, SearchNode, log_query
|
||||
from haystack.constants import ID, DJANGO_ID, DJANGO_CT
|
||||
from haystack.exceptions import HaystackError, MissingDependency
|
||||
from haystack.inputs import AutoQuery
|
||||
from haystack.models import SearchResult
|
||||
from haystack.utils import get_identifier, get_model_ct
|
||||
|
||||
|
|
@ -1011,6 +1012,15 @@ class XapianSearchQuery(BaseSearchQuery):
|
|||
expression, term = child
|
||||
field_name, filter_type = search_node.split_expression(expression)
|
||||
|
||||
# Identify and parse AutoQuery
|
||||
if isinstance(term, AutoQuery):
|
||||
if field_name != 'content':
|
||||
query = '%s:%s' % (field_name, term.prepare(self))
|
||||
else:
|
||||
query = term.prepare(self)
|
||||
query_list.append(self.backend.parse_query(query))
|
||||
continue
|
||||
|
||||
# Handle `ValuesListQuerySet`.
|
||||
if hasattr(term, 'values_list'):
|
||||
term = list(term)
|
||||
|
|
|
|||
Loading…
Reference in a new issue