Why is django-sphinx displaying only 20 results? How can I get everything else?

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

I am SURE that there is a way around this, and that it is by design, but it officially supersedes the hell out of me. Does anyone know how to get a complete request?

+3
source share
3 answers

I realized this at last.

Queries apparently only return 20 hits until you gain access to the query set. Or something like that.

So, if you clearly want to go through all this, you need to do:

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

- , . . ... .

+2

_limit . :

qs = MyEntity.search.query(query_string)
qs._limit = limit
for result in qs:
    print result
0

work for me:

in sphinx configuration file:

   max_matches     = 5000

in django code:

   desc_obj = Dictionary.search.query( search_desc )
   desc_obj._maxmatches = 5000

or in the settings:

   SPHINX_MAX_MATCHES = 5000
0
source

Source: https://habr.com/ru/post/1741853/


All Articles