1👍
This is intended behaviour – it is the docstring that is wrong. The function index_queryset
basically returns the queryset that Haystack will use to obtain the search results (as well as to index documents).
You say:
The method itself gets all the objects from the database and is very slow
Actually it doesn’t. All the method does is return a queryset. Querysets are lazy, so the method doesn’t hit the database. The database only gets hit when something tried to access the results of the queryset.
This will happen after your search has been executed and Haystack returns the results. At this point the queryset will be further filtered to return the objects that matched the search. If this is slow then it may indicate a more fundamental performance issue with your model structure.