Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django-sphinx returns not more than 20 resuts #23

Open
dmitrikozlov opened this issue Mar 22, 2011 · 1 comment
Open

Django-sphinx returns not more than 20 resuts #23

dmitrikozlov opened this issue Mar 22, 2011 · 1 comment

Comments

@dmitrikozlov
Copy link

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.

@adw0rd
Copy link

adw0rd commented Jun 22, 2012

Fixed adw0rd@40334c3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants