From 2b4bb2b7180ea7d75848c982139b6270b97a8f9c Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Thu, 23 Nov 2017 16:38:30 +0100 Subject: [PATCH] Renames `query_string` arguments to `query`. --- wagtail/wagtailsearch/backends/base.py | 6 +++--- wagtail/wagtailsearch/queryset.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wagtail/wagtailsearch/backends/base.py b/wagtail/wagtailsearch/backends/base.py index 55d7b39191..9ff3d6d1ee 100644 --- a/wagtail/wagtailsearch/backends/base.py +++ b/wagtail/wagtailsearch/backends/base.py @@ -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) diff --git a/wagtail/wagtailsearch/queryset.py b/wagtail/wagtailsearch/queryset.py index 3471a48691..557e48ef2d 100644 --- a/wagtail/wagtailsearch/queryset.py +++ b/wagtail/wagtailsearch/queryset.py @@ -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)