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.
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.