improvements to search functionality

This commit is contained in:
Sam
2021-03-02 11:01:22 +00:00
parent 626461bd99
commit 9baa13f30a
3 changed files with 12 additions and 74 deletions

View File

@@ -161,12 +161,14 @@ def product_search(request):
for chunk in chunks:
product_set, min_price, max_price = find_related_products_v6(chunk, shipping_cost, discount, category, tags, price_min, price_max)
# update price values
if prices['min'] is None or min_price['price__min'] < prices['min']:
prices['min'] = min_price['price__min']
if prices['max'] is None or max_price['price__max'] > prices['max']:
prices['max'] = max_price['price__max']
# add to result set
result_set.update(product_set)
if product_set:
# import ipdb; ipdb.set_trace()
if prices['min'] is None or min_price['price__min'] < prices['min']:
prices['min'] = min_price['price__min']
if prices['max'] is None or max_price['price__max'] > prices['max']:
prices['max'] = max_price['price__max']
# add to result set
result_set.update(product_set)
# TODO: add search for entire phrase ???
# extract filters from result_set