mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 00:33:17 +00:00
Remove shortcut queries
This commit is contained in:
parent
2926304e84
commit
0fbac14d3c
3 changed files with 2 additions and 18 deletions
|
|
@ -11,7 +11,7 @@ from django.utils.encoding import force_text
|
|||
from wagtail.search.backends.base import (
|
||||
BaseSearchBackend, BaseSearchQueryCompiler, BaseSearchResults)
|
||||
from wagtail.search.index import RelatedFields, SearchField, get_indexed_models
|
||||
from wagtail.search.query import And, Boost, MatchAll, Not, Or, PlainText, Prefix, SearchQueryShortcut, Term
|
||||
from wagtail.search.query import And, Boost, MatchAll, Not, Or, PlainText, Prefix, Term
|
||||
from wagtail.search.utils import ADD, AND, OR
|
||||
|
||||
from .models import SearchAutocomplete as PostgresSearchAutocomplete
|
||||
|
|
@ -248,8 +248,6 @@ class PostgresSearchQueryCompiler(BaseSearchQueryCompiler):
|
|||
if isinstance(query, Boost):
|
||||
boost *= query.boost
|
||||
return self.build_database_query(query.subquery, config, boost=boost)
|
||||
if isinstance(query, SearchQueryShortcut):
|
||||
return self.build_database_query(query.get_equivalent(), config, boost=boost)
|
||||
if isinstance(query, Prefix):
|
||||
self.check_boost(query, boost=boost)
|
||||
self.is_autocomplete = True
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from django.db.models.expressions import Value
|
|||
|
||||
from wagtail.search.backends.base import (
|
||||
BaseSearchBackend, BaseSearchQueryCompiler, BaseSearchResults)
|
||||
from wagtail.search.query import And, Boost, MatchAll, Not, Or, PlainText, Prefix, SearchQueryShortcut, Term
|
||||
from wagtail.search.query import And, Boost, MatchAll, Not, Or, PlainText, Prefix, Term
|
||||
from wagtail.search.utils import AND, OR
|
||||
|
||||
|
||||
|
|
@ -77,8 +77,6 @@ class DatabaseSearchQueryCompiler(BaseSearchQueryCompiler):
|
|||
if isinstance(self.query, MatchAll):
|
||||
return models.Q()
|
||||
|
||||
if isinstance(query, SearchQueryShortcut):
|
||||
return self.build_database_filter(query.get_equivalent(), boost=boost)
|
||||
if isinstance(query, Term):
|
||||
self.check_boost(query)
|
||||
return self.build_single_term_filter(query.term)
|
||||
|
|
|
|||
|
|
@ -54,13 +54,6 @@ class MultiOperandsSearchQueryOperator(SearchQueryOperator):
|
|||
yield from self.subqueries
|
||||
|
||||
|
||||
class SearchQueryShortcut(SearchQuery):
|
||||
def get_equivalent(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_children(self):
|
||||
yield self.get_equivalent()
|
||||
|
||||
#
|
||||
# Operators
|
||||
#
|
||||
|
|
@ -149,9 +142,4 @@ class Fuzzy(SearchQuery):
|
|||
return func(self.__class__(self.term, self.max_distance, self.boost))
|
||||
|
||||
|
||||
#
|
||||
# Shortcut query classes
|
||||
#
|
||||
|
||||
|
||||
MATCH_ALL = MatchAll()
|
||||
|
|
|
|||
Loading…
Reference in a new issue