Search code examples
djangoautocompletetriedjango-autocomplete-light

How to accelerate autocomplete function with Django?


I have implemented django-autocomplete-light on my website (Python 3.6.5 / Django 1.11.20) but retrieving results is very slow (www.capelight.com).

The source database is made of 12,000 names (cities, provinces, etc). How can I accelerate this process ?

I have read that implementing a Trie strongly accelerates the process, but I have no clue how to do that. Or maybe django-autocomplete is already based on Trie ? Thanks a lot


Solution

  • from haystack.query import SearchQuerySet

    SearchQuerySet().autocomplete(content_auto='name1, name2, name3...')