Skip to content

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

Add possibility to search on unpublished products

fowczarekd0f029e3c30d
diff --git a/saleor/search/backends/postgresql_storefront.py b/saleor/search/backends/postgresql_storefront.py
index 759e2aa4cc..fadc7f178e 100644
--- a/saleor/search/backends/postgresql_storefront.py
+++ b/saleor/search/backends/postgresql_storefront.py
@@ -16,10 +16,9 @@ def search(phrase):
"""
name_sim = TrigramSimilarity("name", phrase)
- published = Q(is_published=True)
ft_in_description = Q(description__search=phrase)
ft_by_sku = Q(variants__sku__search=phrase)
name_similar = Q(name_sim__gt=0.2)
return Product.objects.annotate(name_sim=name_sim).filter(
- (ft_in_description | name_similar | ft_by_sku) & published
+ (ft_in_description | name_similar | ft_by_sku)
)
diff --git a/tests/test_postgresql_search.py b/tests/test_postgresql_search.py
index b683c63c68..195abf41e9 100644
--- a/tests/test_postgresql_search.py
+++ b/tests/test_postgresql_search.py
@@ -61,13 +61,6 @@ def unpublish_product(product):
prod_to_unpublish.save()
-def test_storefront_filter_published_products(named_products):
- unpublish_product(named_products[0])
- assert not execute_search("Coffee")
-
-
USERS = [
("Andreas", "Knop", "[email protected]"),
("Euzebiusz", "Ziemniak", "[email protected]"),