Search code examples
solrpaginationsunburnt

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.


Solution

  • 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.