How to get all results from solr query?

后端 未结 8 896
温柔的废话
温柔的废话 2021-01-01 10:36

I executed some query like \"Address:Jack*\". It show numFound = 5214 and display 100 documents in results page(I changed default display results f

8条回答
  •  猫巷女王i
    2021-01-01 11:22

    The way I dealt with the problem is by running the query twice:

    // Start with your (usually small) default page size
    solrQuery.setRows(50); 
    QueryResponse response = solrResponse(query);
    if (response.getResults().getNumFound() > 50) {
        solrQuery.setRows(response.getResults().getNumFound()); 
        response = solrResponse(query);
    }
    

    It makes a call twice to Solr, but gets you all matching records....with the small performance penalty.

提交回复
热议问题