for example, I have created module with next code:
/**
* Implementation of hook_apachesolr_modify_query().
*/
function MYMODULE_apachesolr_modify_query(&$query, &$params, $caller) {
// ... //
if ($condition_1) {
$params['rows'] = 50;
}
else if ($condition_2) {
$params['rows'] = 100;
}
else {
// leave default
}
}
so when we use search we have see 50, 100 or default number of results... but pager will be generated always for default number of rows.
the problem is in "apachesolr_do_query" function that called in "apachesolr_search_execute" function.
we need to change input arguments from
function apachesolr_do_query($caller, $current_query, $params = array('rows' => 10), $page = 0) {
to
function apachesolr_do_query($caller, $current_query, &$params, $page = 0) {
"apachesolr_do_query" function call "apachesolr_modify_query" function, so $params array can be changed with another module,
but if "apachesolr_pager_init" function is called ("apachesolr_search_execute" (here called "apachesolr_do_query") -> "apachesolr_process_response" -> "apachesolr_pager_init") changes from "apachesolr_modify_query" do not have effect,
so when we use "apachesolr_search_execute" function pager are always generated for default number of rows ignoring changes from _apachesolr_modify_query hooks
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 875158.patch | 906 bytes | jpmckinney |
Comments
Comment #1
jpmckinney commentedPatch for 6--2. 5--2 and 6--1 have same issue, patch will probably apply.
Comment #2
jpmckinney commentedMarking duplicate of #899560: apachesolr_do_query() has to take &$params by reference