Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Clean querysets
Jakub Draganek970a49a06bd4
diff --git a/saleor/search/backends/elasticsearch.py b/saleor/search/backends/elasticsearch.pyindex 7763229614..ddf0c4acb2 100644--- a/saleor/search/backends/elasticsearch.py+++ b/saleor/search/backends/elasticsearch.py@@ -13,5 +13,5 @@ def get_search_query(phrase):.filter('term', is_published=True))-def search(phrase, qs):- return qs & get_search_query(phrase).to_queryset()+def search(phrase):+ return get_search_query(phrase).to_queryset()diff --git a/saleor/search/forms.py b/saleor/search/forms.pyindex 28c401271f..65bf35c803 100644--- a/saleor/search/forms.py+++ b/saleor/search/forms.py@@ -7,5 +7,5 @@ class SearchForm(forms.Form):q = forms.CharField(label=pgettext('Search form label', 'Query'), required=True)- def search(self, qs):- return elasticsearch.search(self.cleaned_data['q'], qs)+ def search(self):+ return elasticsearch.search(self.cleaned_data['q'])diff --git a/saleor/search/views.py b/saleor/search/views.pyindex 6bb1edd1c9..05d4a8d8cb 100644--- a/saleor/search/views.py+++ b/saleor/search/views.py@@ -20,8 +20,7 @@ def paginate_results(results, get_data, paginate_by=settings.PAGINATE_BY):def evaluate_search_query(form, request):query = form.cleaned_data.get('q', '')- visible_products = products_with_details(request.user)- results = form.search(qs=visible_products)+ results = products_with_details(request.user) & form.search()results = products_with_availability(results,discounts=request.discounts,