Apply pagination using sunburnt highlighted search
I am using Sunburnt Python Api For Solr Search
I am using highlighted search in Sunburnt it works fine
I am using the following code
search_record = solrconn.query(search_text).highlight("content").highlight("title") records = search_record.execute().highlighting
Problem is it returns only 10 records. I know it can be change from solr-config.xml but issue is i want all records
I want to apply pagination using highlighted search of sunburnt
can any one help me ....
Given the SOLR-534 issue, which is still unresolved, you can't tell Solr to give you all results, but you can use a really high rows parameter depending on how many documents you expect to have in your index. I don't know anything about sunburnt but I believe something like this should work:
search_record = solrconn.query(search_text).paginate(rows=10000).highlight("content").highlight("title")
You just have to replace the rows value with something enough big depending on your index size.
The general approach to this is to use a paginator:
from django.core.paginator import Paginator
paginator = Paginator(si.query("black"), 30)
Once that's done, you can just paginate through everything:
for result in paginator.object_list: print result