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

CommentFileSizeAuthor
#1 875158.patch906 bytesjpmckinney

Comments

jpmckinney’s picture

Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new906 bytes

Patch for 6--2. 5--2 and 6--1 have same issue, patch will probably apply.

jpmckinney’s picture

Status: Needs review » Closed (duplicate)