Skip to content

Django-sphinx returns not more than 20 resuts #23

@dmitrikozlov

Description

@dmitrikozlov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions