0%

How to request a limited number of documents: rows parameter

The rows parameter specifies the maximum number of documents from the complete result set that Solr should return at one time.

The default value is 10, which is why we can’t request all the data from one core using *:* in the q parameter.

I know what you’re thinking! If the whole core contains 100,000 data points, you can use this number in the rows parameter. Yes, it is possible, but the request will be ineffective, and results may be lost in case of an unstable connection. Instead, please use batch_solr_request to download the data.

num_found, df = solr_request(
    core='statistical-result', 
    params={
        'q': '*:*',
        'rows': 3
    }
)

In the example above, three documents from the statistical-result core were requested.