Question

Solarium (and solr) default to returning 10 results if a limit is not specified. I know that I can specify a limit using $query->setRows(25); but I need to return all results (no matter how large). Is there a way to specify this without passing in a arbitrarily large number to setRows()? I'm not seeing anything in the documentation.......

Was it helpful?

Solution 2

I posted this to the support forum, and the developer suggested using the PreFetchIterator plugin.

PreFetchIterator plugin

OTHER TIPS

Here is something that may enlighten and actually the wiki answers this question. You may be better off using a big number to get your rows as per the documentation.

From here

How can I get ALL the matching documents back? ... How can I return an unlimited number of rows?

This is impractical in most cases. People typically only want to do this when they know they are dealing with an index whose size guarantees the result sets will be always be small enough that they can feasibly be transmitted in a manageable amount -- but if that's the case just specify what you consider a "manageable amount" as your rows param and get the best of both worlds (all the results when your assumption is right, and a sanity cap on the result size if it turns out your assumptions are wrong)

Additionally this is what the documentation for setRows mentions here
Rows

This parameter is used to paginate results from a query. It specify the maximum number of documents from the complete result set to return to the client for every request. You can consider it as the maximum number of result appear in the page.

The default value is "10", which is used if the parameter is not specified. If you want to tell Solr to return all possible results from the query without an upper bound, specify rows to be 10000000 or some other ridiculously large value that is higher than the possible number of rows that are expected.

There is a nice discussion about this here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top