Skip to content

Commit

Permalink
Merge pull request #1781 from chessbr/simple-search-fields
Browse files Browse the repository at this point in the history
Front: add settings to change the list of fields to be used in search query
  • Loading branch information
tulimaki committed Mar 12, 2019
2 parents 612fa12 + 259f73a commit 88f3fc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions shuup/front/apps/simple_search/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def get_product_ids_for_query_str(request, query_str, limit, product_ids=[]):
if not query_str:
return []

entry_query = get_compiled_query(
query_str, ['sku', 'translations__name', 'translations__description', 'translations__keywords'])
entry_query = get_compiled_query(query_str, settings.SHUUP_SIMPLE_SEARCH_FIELDS)
return list(Product.objects.searchable(
shop=request.shop,
customer=request.customer
Expand Down
5 changes: 5 additions & 0 deletions shuup/front/apps/simple_search/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
#: The limit number of products to be returned by the search
#:
SHUUP_SIMPLE_SEARCH_LIMIT = 150


#: List of fields to be used in products search query
#:
SHUUP_SIMPLE_SEARCH_FIELDS = ['sku', 'translations__name', 'translations__description', 'translations__keywords']

0 comments on commit 88f3fc4

Please sign in to comment.