Choosing any other search than the default node causes the search block to not work. The feature was introduced in the 5.x-1.4 version. Original issue can be found here http://drupal.org/node/295136.

The problem is the core search module assumes that block search will always default to node as can be see from the following function:

/**
 * Process a block search form submission.
 */
function search_box_form_submit($form, &$form_state) {
  $form_id = $form['form_id']['#value'];
  $form_state['redirect'] = 'search/node/'. trim($form_state['values'][$form_id]);
}

Changing to the following seems to work.



/**
 * Process a block search form submission.
 */
function search_config_form_submit($form, &$form_state) {
  $form_id = $form['form_id']['#value'];
  $type = $form['module']['#value'];
  $form_state['redirect'] = 'search/'. $type .'/'. trim($form_state['values'][$form_id]);
}

This should probable be filed as a bug against core.

Comments

canen’s picture

That should have been changed to

/**
* Process a block search form submission.
*/
function search_form_submit($form, &$form_state) {
  $form_id = $form['form_id']['#value'];
  $type = $form['module']['#value'];
  $form_state['redirect'] = 'search/'. $type .'/'. trim($form_state['values'][$form_id]);
}
canen’s picture

Semi-fixed in this commit: http://drupal.org/cvs?commit=162846

There are other issues however. Node is always selected as the default search on the search page (/search). I can't really see a clear way around this but it might not be that much of an issue in practice since you can just selected it from the tab. Also, if you are search directly via the URL it has to be search/$type/text anyway.

canen’s picture

Status: Active » Closed (fixed)