added search filter by tags
This commit is contained in:
@@ -151,6 +151,9 @@ def product_search(request):
|
||||
- limit: max number of returned instances [OPTIONAL]
|
||||
- offset: where to start counting results [OPTIONAL]
|
||||
- shipping_cost: true/false
|
||||
- discount: true/false
|
||||
- category: string
|
||||
- tags: string
|
||||
"""
|
||||
# capture query params
|
||||
query_string = request.GET.get('query_string', None)
|
||||
@@ -173,6 +176,7 @@ def product_search(request):
|
||||
else:
|
||||
discount = None
|
||||
category = request.GET.get('category', None)
|
||||
tags = request.GET.get('tags', None)
|
||||
|
||||
if query_string is None:
|
||||
return Response({"errors": {"details": "No query string to parse"}})
|
||||
@@ -189,7 +193,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, category)
|
||||
product_set = find_related_products_v6(chunk, shipping_cost, discount, category, tags)
|
||||
# add to result set
|
||||
result_set.update(product_set)
|
||||
# TODO: add search for entire phrase ???
|
||||
|
||||
Reference in New Issue
Block a user