1👍
✅
Don’t see an issue with your indexes long as you ensure that indexes are updated. In your views you neither passing search query or using autocomplete field to query on.
Please try with this.
def autocomplete(request):
search_query = request.GET.get("q",None)
if not search_query:
raise Http404
autosuggest = SearchQuerySet().autocomplete(content_auto=search_query)[:5]
try:
autosuggest_results = map(lambda x: x.object.title, autosuggest)
response = {"results": autosuggest_results}
return JsonResponse(response)
except Exception:
raise Http404()
Source:stackexchange.com