djangosphinxdjango-sphinx

Why does django-sphinx only output 20 results? How can I get the rest?


Doing a search using django-sphinx gives me results._sphinx that says there were 68 results, but when I iterate over them, I can only get at the first 20 of them.

I'm SURE there's a way around this, and that this is by design, but it's officially stumping the heck out of me. Does anybody know how to get the complete queryset?


Solution

  • I figured this out finally.

    Apparently, the querysets only return 20 hits until you access the queryset. Or something like that.

    So, if you explicitly want the iterate over the whole thing, you have to do:

    for result in results[0:results.count()]:
        print result
    

    Or something to that effect, which will query the entire thing explicitly. Ugh. This should be clearly documented...but it not.