django-sphinx
django-sphinx copied to clipboard
Django-sphinx returns not more than 20 resuts
QuerySet returned by sphinx may report more than 20 items in it but enumeration will return only first 20.
qset = Myclass.sphinx_search.query(q) print qset.count() #prints more than 20
the enumeration loop stops after 20 iteration
for e in qset: do something
This question was also asked on stackoverflow: http://stackoverflow.com/questions/2671459/why-does-django-sphinx-only-output-20-results-how-can-i-get-the-rest
A solution proposed is to evaluate the query set: for e in qset[0:qset.count()]: do something
This works fine for small sets but could have a large memory overhead because all items might need to be loaded in memory. In contrast, iterating over a QuerySet will load objects only as you need them.
It would be better to make the first approach work.
Fixed https://github.com/adw0rd/django-sphinx/commit/40334c35c4e3f27ec34d47f07c74b42cc8de5901