Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Simplify dashboard product search

Jakub Draganek389cb16b1d2c
diff --git a/saleor/search/backends/postgresql_dashboard.py b/saleor/search/backends/postgresql_dashboard.py
index 5a8a7f0b65..2998d5ffb5 100644
--- a/saleor/search/backends/postgresql_dashboard.py
+++ b/saleor/search/backends/postgresql_dashboard.py
@@ -8,11 +8,8 @@ from ...userprofile.models import User
def search_products(phrase):
- name_sim = TrigramSimilarity('name', phrase)
- ft_in_description = Q(description__search=phrase)
- name_similar = Q(name_sim__gt=0.2)
- return Product.objects.annotate(name_sim=name_sim).filter(
- ft_in_description | name_similar)
+ sv = SearchVector('name', 'description')
+ return Product.objects.annotate(search=sv).filter(search=phrase)
def search_orders(phrase):