enabled search by category
This commit is contained in:
@@ -152,6 +152,7 @@ def product_search(request):
|
||||
- offset: where to start counting results [OPTIONAL]
|
||||
- shipping_cost: true/false
|
||||
"""
|
||||
# capture query params
|
||||
query_string = request.GET.get('query_string', None)
|
||||
limit = request.GET.get('limit', None)
|
||||
offset = request.GET.get('offset', None)
|
||||
@@ -171,6 +172,7 @@ def product_search(request):
|
||||
discount = False
|
||||
else:
|
||||
discount = None
|
||||
category = request.GET.get('category', None)
|
||||
|
||||
if query_string is None:
|
||||
return Response({"errors": {"details": "No query string to parse"}})
|
||||
@@ -187,7 +189,7 @@ def product_search(request):
|
||||
# split query string into single words
|
||||
chunks = query_string.split(' ')
|
||||
for chunk in chunks:
|
||||
product_set = find_related_products_v6(chunk, shipping_cost, discount)
|
||||
product_set = find_related_products_v6(chunk, shipping_cost, discount, category)
|
||||
# add to result set
|
||||
result_set.update(product_set)
|
||||
# TODO: add search for entire phrase ???
|
||||
|
||||
Reference in New Issue
Block a user