Index: modules/search/search.admin.inc =================================================================== --- modules/search/search.admin.inc (revision 97) +++ modules/search/search.admin.inc (working copy) @@ -62,6 +62,9 @@ $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).')); $form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk', TRUE), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.')); + $form['default_search_settings'] = array('#type'=>'fieldset','#title'=>t('Default Search Type')); + $form['default_search_settings']['default_search_type'] = array('#type'=>'textfield','#title'=>t('Enter the default search type'),'#default_value'=>variable_get('default_search_type', 'node'),'#description'=>t('This is the default search that is done when a user enters something in the search box.')); + $form['#validate'] = array('search_admin_settings_validate'); // Per module settings Index: modules/search/search.module =================================================================== --- modules/search/search.module (revision 97) +++ modules/search/search.module (working copy) @@ -1068,6 +1068,7 @@ '#default_value' => '', '#attributes' => array('title' => t('Enter the terms you wish to search for.')), ); + $form['search_type'] = array('#type' => 'hidden', '#value' => variable_get('default_search_type','node')); $form['submit'] = array('#type' => 'submit', '#value' => t('Search')); $form['#submit'][] = 'search_box_form_submit'; $form['#validate'][] = 'search_box_form_validate'; @@ -1080,7 +1081,8 @@ */ 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]); + $type = isset($form_state['values']['search_type']) ? $form_state['values']['search_type'] : variable_get('default_search_type','node'); + $form_state['redirect'] = 'search/'. $type .'/'. trim($form_state['values'][$form_id]); } /** Index: modules/search/search.pages.inc =================================================================== --- modules/search/search.pages.inc (revision 97) +++ modules/search/search.pages.inc (working copy) @@ -9,7 +9,7 @@ /** * Menu callback; presents the search form and/or search results. */ -function search_view($type = 'node') { +function search_view($type = '') { // Search form submits with POST but redirects to GET. This way we can keep // the search query URL clean as a whistle: // search/type/keyword+keyword @@ -18,7 +18,7 @@ // Note: search/node can not be a default tab because it would take on the // path of its parent (search). It would prevent remembering keywords when // switching tabs. This is why we drupal_goto to it from the parent instead. - drupal_goto('search/node'); + drupal_goto('search/' . variable_get('default_search_type', 'node')); } $keys = search_get_keys(); @@ -52,6 +52,11 @@ return $output; } + // get the default type from a variable + if ($type=='') { + $type = variable_get('default_search_type', 'node'); + } + return drupal_get_form('search_form', NULL, empty($keys) ? '' : $keys, $type); } @@ -130,7 +135,7 @@ // Fall through to the drupal_goto() call. } - $type = $form_state['values']['module'] ? $form_state['values']['module'] : 'node'; + $type = $form_state['values']['module'] ? $form_state['values']['module'] : variable_get('default_search_type', 'node'); $form_state['redirect'] = 'search/'. $type .'/'. $keys; return; }