Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.222 diff -u -F^function -r1.222 search.module --- modules/search/search.module 15 May 2007 05:43:16 -0000 1.222 +++ modules/search/search.module 23 May 2007 16:12:11 -0000 @@ -251,6 +251,25 @@ function search_admin_settings() { $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.')); + // Display settings: + $form['search_results'] = array( + '#type' => 'fieldset', + '#title' => t('Show in search results'), + '#description' => t('Select which additional information, besides title and snippet, should be displayed for each search result. This setting will have no effect on content types whose post information is never displayed (as per your !theme).', array('!theme' => l(t('theme settings'), 'admin/build/themes/settings/global'))), + '#collapsible' => FALSE, + '#collapsed' => FALSE, + ); + $form['search_results']['search_result_display_setting'] = array( + '#type' => 'checkboxes', + '#default_value' => variable_get('search_result_display_setting', array('date', 'user', 'type', 'extra')), + '#options' => array( + 'date' => t('Date'), + 'user' => t('Author'), + 'type' => t('Content type'), + 'extra' => t('Module-provided fields'), + ), + ); + // Per module settings $form = array_merge($form, module_invoke_all('search', 'admin')); @@ -1267,17 +1286,20 @@ function _search_excerpt_replace(&$text) */ function theme_search_item($item, $type) { $output = '
'. check_plain($item['title']) .'
'; + if (!isset($item['node']) || theme_get_setting('toggle_node_info_'. $item['node']->type)) { + $display_setting = array_filter(variable_get('search_result_display_setting', array('date', 'user', 'type', 'extra'))); + } $info = array(); - if (!empty($item['type'])) { + if (!empty($item['type']) && isset($display_setting['type'])) { $info[] = $item['type']; } - if (!empty($item['user'])) { + if (!empty($item['user']) && isset($display_setting['user'])) { $info[] = $item['user']; } - if (!empty($item['date'])) { + if (!empty($item['date']) && isset($display_setting['date'])) { $info[] = format_date($item['date'], 'small'); } - if (isset($item['extra']) && is_array($item['extra'])) { + if (isset($item['extra']) && is_array($item['extra']) && isset($display_setting['extra'])) { $info = array_merge($info, $item['extra']); } $output .= '
'. (!empty($item['snippet']) ? '

'. $item['snippet'] .'

' : '') .'

'. implode(' - ', $info) .'

';