Closed (fixed)
Project:
Search configuration
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2009 at 01:40 UTC
Updated:
25 May 2009 at 03:11 UTC
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
Comment #1
canen commentedThat should have been changed to
Comment #2
canen commentedSemi-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.
Comment #3
canen commented