Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.216 diff -u -F^f -r1.216 search.module --- modules/search/search.module 27 Mar 2007 05:13:54 -0000 1.216 +++ modules/search/search.module 31 Mar 2007 23:55:29 -0000 @@ -900,6 +900,8 @@ function search_get_keys() { * Menu callback; presents the search form and/or search results. */ function search_view($type = 'node') { + global $pager_total_items, $search_timer; + // 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 @@ -915,12 +917,18 @@ function search_view($type = 'node') { // Only perform search if there is non-whitespace search term: $results = ''; if (trim($keys)) { - // Log the search keys: - watchdog('search', t('%keys (@type).', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name'))), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys)); + timer_start('search'); // Collect the search results: $results = search_data($keys, $type); + if (!isset($search_timer)){ + $search_timer = timer_stop('search'); + } + + // Log the search keys: + watchdog('search', t('%keys (@type) - @result in @time sec', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name'), '@result' => format_plural($pager_total_items[0], '1 match', '@count matches'), '@time' => round($search_timer['time'] / 1000, 2) )), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys)); + if ($results) { $results = theme('box', t('Search results'), $results); } @@ -1274,13 +1282,27 @@ function theme_search_item($item, $type) * @ingroup themeable */ function theme_search_page($results, $type) { - $output = '
'; + global $pager_page_array, $pager_total_items, $search_timer; + + $pager = theme('pager', NULL, 10, 0); + + if (!isset($search_timer)){ + $search_timer = timer_stop('search'); + } + $values['@total'] = $pager_total_items[0]; + $values['@start'] = ($pager_page_array[0] * 10) + 1; + $values['@end'] = min(($pager_page_array[0] + 1) * 10, $values['@total']); + $values['@time'] = round($search_timer['time'] / 1000, 2); + $values['%keys'] = search_get_keys(); + $output = t('Displaying @start - @end of @total for %keys. (@time sec)', $values); + + $output .= '
'; foreach ($results as $entry) { $output .= theme('search_item', $entry, $type); } $output .= '
'; - $output .= theme('pager', NULL, 10, 0); + $output .= $pager; return $output; }