awesto / django-shop

A Django based shop system
http://www.django-shop.org
BSD 3-Clause "New" or "Revised" License
3.2k stars 1.04k forks source link

enable pagination for search results #836

Open markusmo opened 3 years ago

markusmo commented 3 years ago

I encountered the problem, that there where always 10 results in my search-results-page. So I read the elasticsearch-dsl documentation and it stated, that elasticsearch always returns only 10 results at a time.

To paginate we would have to use python slice operator, but as pagination is done in the front-end, I return all the results by using search = search[0:search.count()] and then using search.to_queryset() which will result in a queryset containing all results found at a time.

Then the front-end is able to also paginate and show more than 10 results.