django-sphinx icon indicating copy to clipboard operation
django-sphinx copied to clipboard

Django-sphinx returns not more than 20 resuts

Open dmitrikozlov opened this issue 13 years ago • 1 comments

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.

dmitrikozlov avatar Mar 22 '11 12:03 dmitrikozlov

Fixed https://github.com/adw0rd/django-sphinx/commit/40334c35c4e3f27ec34d47f07c74b42cc8de5901

adw0rd avatar Jun 22 '12 11:06 adw0rd