Renames `query_string` arguments to `query`.

pull/4059/head
Bertrand Bordage 2017-11-23 16:38:30 +01:00
rodzic 69789d7c35
commit 2b4bb2b718
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -241,7 +241,7 @@ class BaseSearchBackend(object):
def delete(self, obj):
raise NotImplementedError
def search(self, query_string, model_or_queryset, fields=None, filters=None,
def search(self, query, model_or_queryset, fields=None, filters=None,
prefetch_related=None, operator=None, order_by_relevance=True):
# Find model/queryset
if isinstance(model_or_queryset, QuerySet):
@ -256,7 +256,7 @@ class BaseSearchBackend(object):
return EmptySearchResults()
# Check that theres still a query string after the clean up
if query_string == "":
if query == "":
return EmptySearchResults()
# Only fields that are indexed as a SearchField can be passed in fields
@ -287,6 +287,6 @@ class BaseSearchBackend(object):
# Search
search_query = self.query_compiler_class(
queryset, query_string, fields=fields, operator=operator, order_by_relevance=order_by_relevance
queryset, query, fields=fields, operator=operator, order_by_relevance=order_by_relevance
)
return self.results_class(self, search_query)

Wyświetl plik

@ -4,11 +4,11 @@ from wagtail.wagtailsearch.backends import get_search_backend
class SearchableQuerySetMixin(object):
def search(self, query_string, fields=None,
def search(self, query, fields=None,
operator=None, order_by_relevance=True, backend='default'):
"""
This runs a search query on all the items in the QuerySet
"""
search_backend = get_search_backend(backend)
return search_backend.search(query_string, self, fields=fields,
return search_backend.search(query, self, fields=fields,
operator=operator, order_by_relevance=order_by_relevance)