Closed (duplicate)
Project:
Apache Solr Search
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2010 at 10:57 UTC
Updated:
21 Mar 2011 at 09:44 UTC
It is possible to change the number of displayed rows via hook_apachesolr_modify_query:
function MODULENAME_apachesolr_modify_query(&$query, &$params, $caller) {
$page = $params['rows'] ? $params['start'] / $params['rows'] : 0;
$params['rows'] = 12;
$params['start'] = $page * $params['rows'];
}
That works. If I have 1000 results, I would have 84 pages (ceil(1000 / 12)), but the pager still displays 100 pages (this is based on the default setting of 10 results per page). Clicking the last link in the pager leads to a page which says that there are not search results.
The patch attached changes apachesolr_search_execute to pass $params as a reference to apachesolr_do_query (which will indirectly invoke the modify query hooks).
The changed params are passed to apachesolr_process_response, where the pager is going to be initialized, now always with the correct number of rows.
| Comment | File | Size | Author |
|---|---|---|---|
| apachesolr_pager.patch | 692 bytes | mauritsl |
Comments
Comment #1
pwolanin commentedseem like do_query should specify that the params are by reference? I think you have this backward.
Comment #2
jpmckinney commentedis this not fixed by #899560: apachesolr_do_query() has to take &$params by reference?
Comment #3
mauritsl commentedYes, it will be fixed by that patch. Closing this issue as a duplicate.