Skip to content

Commit

Permalink
fixes helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Owocki authored and Kevin Owocki committed Mar 10, 2021
1 parent c7a1ffc commit 1dc8fd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
def get_search(request):
mimetype = 'application/json'
keyword = request.GET.get('term', '')
return_results = search_helper(keyword)
return_results = search_helper(keyword, request)
return HttpResponse(json.dumps(return_results), mimetype)

def search_helper(keyword):
def search_helper(keyword, request):

# attempt elasticsearch first
return_results = []
try:
all_result_sets = search(keyword)
return_results = [ele['_source'] for ele in all_result_sets['hits']['hits']]

if request.user.is_authenticated:
if request and request.user.is_authenticated:
data = {'keyword': keyword}
SearchHistory.objects.update_or_create(
search_type='sitesearch',
Expand Down

0 comments on commit 1dc8fd0

Please sign in to comment.