history admin dropdown for admin
This commit is contained in:
@@ -87,31 +87,13 @@ def extract_search_filters(result_set):
|
||||
|
||||
def get_related_products(description, tags, attributes, category):
|
||||
products_qs = Product.objects.filter(
|
||||
description=description,
|
||||
tags__in=tags,
|
||||
attributes__in=attributes,
|
||||
category=category
|
||||
)[:6]
|
||||
Q(description=description) |
|
||||
Q(tags__in=tags) |
|
||||
Q(attributes__in=attributes) |
|
||||
Q(category=category)
|
||||
)[:10]
|
||||
return products_qs
|
||||
|
||||
'''
|
||||
def find_related_products_v3(keyword):
|
||||
"""
|
||||
Ranked product search
|
||||
|
||||
SearchVectors for the fields
|
||||
SearchQuery for the value
|
||||
SearchRank for relevancy scoring and ranking
|
||||
"""
|
||||
vector = SearchVector('name') + SearchVector('description') + SearchVector('tags__label') + SearchVector('attributes__label') + SearchVector('category__name')
|
||||
query = SearchQuery(keyword)
|
||||
|
||||
products_qs = Product.objects.annotate(
|
||||
rank=SearchRank(vector, query)
|
||||
).filter(rank__gt=0.05) # removed order_by because its lost in casting
|
||||
|
||||
return set(products_qs)
|
||||
'''
|
||||
|
||||
def ranked_product_search(keyword, shipping_cost=None, discount=None, category=None, tags=None, price_min=None,price_max=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user