enabled search by category
This commit is contained in:
@@ -125,7 +125,7 @@ def find_related_products_v3(keyword):
|
||||
return set(products_qs)
|
||||
|
||||
|
||||
def find_related_products_v6(keyword, shipping_cost=None, discount=None):
|
||||
def find_related_products_v6(keyword, shipping_cost=None, discount=None, category=None):
|
||||
"""
|
||||
Ranked product search
|
||||
|
||||
@@ -143,6 +143,10 @@ def find_related_products_v6(keyword, shipping_cost=None, discount=None):
|
||||
rank=SearchRank(vector, query)
|
||||
).filter(rank__gt=0.05) # removed order_by because its lost in casting
|
||||
|
||||
# filter by category
|
||||
if category is not None:
|
||||
products_qs = products_qs.filter(category=category)
|
||||
|
||||
# filter for shipping cost
|
||||
if shipping_cost is True:
|
||||
# only instances with shipping costs
|
||||
|
||||
Reference in New Issue
Block a user