0

We want to create a search page with Apache Solr with an increased query limit. I was reading that using hook_search_execute was not a recommended way to do this.

Is this statement correct? What would be the recommended way to go about this?

Apache Solr Views module?

Some other solution?

The page absolutely has to have more than 10 search results, and no pager.

2 Answers 2

4

To do that programatically, you can implement hook_apachesolr_query_alter() to play with the rows parameter :

function yourmodule_apachesolr_query_alter($query) {
  // Increase the number of results per query
  $query->replaceParam('rows', 50);
}

Note : To disable the pager you can set a very very large number of rows, but it may impact performance. In this case you may prefer to bypass the pager at another level (for example in a preprocess function) and go with a more reasonable rows value.

1
  • Actually using hook_apachesolr_query_prepare will cause the pager to also use the correct number of rows. Dec 3, 2015 at 14:52
1

There is apparently a setting for this in the Apache Solr module itself.

Go to the specific search that you want to modify, and edit the "Advanced Search Page Options" value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.