Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.973
diff -u -r1.973 node.module
--- modules/node/node.module 31 Aug 2008 15:50:35 -0000 1.973
+++ modules/node/node.module 1 Sep 2008 20:12:19 -0000
@@ -82,6 +82,13 @@
$node = node_load($arg[1]);
$type = node_get_types('type', $node->type);
return (!empty($type->help) ? '
' . filter_xss_admin($type->help) . '
' : '');
+ case 'search#noresults':
+ $noresults = array(
+ t('Check if your spelling is correct.'),
+ t('Remove quotes around phrases to match each word individually: "blue smurf" will match less than blue smurf.'),
+ t('Consider loosening your query with OR: blue smurf will match less than blue OR smurf.'),
+ );
+ return theme('item_list', $noresults);
}
if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) {
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.263
diff -u -r1.263 search.module
--- modules/search/search.module 21 Aug 2008 19:36:38 -0000 1.263
+++ modules/search/search.module 1 Sep 2008 20:14:20 -0000
@@ -102,12 +102,6 @@
return $output;
case 'admin/settings/search':
return '' . t('The search engine maintains an index of words found in your site\'s content. To build and maintain this index, a correctly configured cron maintenance task is required. Indexing behavior can be adjusted using the settings below.', array('@cron' => url('admin/reports/status'))) . '
';
- case 'search#noresults':
- return t('
-- Check if your spelling is correct.
-- Remove quotes around phrases to search for each word individually. bike shed will often show more results than "bike shed".
-- Consider loosening your query with OR. bike OR shed will often show more results than bike shed.
-
');
}
}
Index: modules/search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.5
diff -u -r1.5 search.pages.inc
--- modules/search/search.pages.inc 14 Apr 2008 17:48:41 -0000 1.5
+++ modules/search/search.pages.inc 1 Sep 2008 20:12:19 -0000
@@ -35,7 +35,8 @@
$results = theme('box', t('Search results'), $results);
}
else {
- $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
+ $help = module_invoke($type, 'help', 'search#noresults', drupal_help_arg());
+ $results = theme('box', t('Your search yielded no results'), $help);
}
}
Index: modules/search/search.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.test,v
retrieving revision 1.6
diff -u -r1.6 search.test
--- modules/search/search.test 5 Jun 2008 21:55:45 -0000 1.6
+++ modules/search/search.test 1 Sep 2008 20:12:19 -0000
@@ -159,6 +159,34 @@
// Check range.
$this->assertEqual(!count($scores) || (min($scores) > 0.0 && max($scores) <= 1.0001), TRUE, "Query scoring '$query'");
}
+
+}
+
+class SearchNoResultsTestCase extends DrupalWebTestCase {
+ /**
+ * Implementation of getInfo().
+ */
+ function getInfo() {
+ return array(
+ 'name' => t('Search help test'),
+ 'description' => t('Tests the search help hook'),
+ 'group' => t('Search'),
+ );
+ }
+
+ /**
+ * Implementation setUp().
+ */
+ function setUp() {
+ parent::setUp('search');
+ }
+
+ function testSearchHelpHook() {
+ foreach (module_implements('search') as $module) {
+ $output = module_invoke($module, 'help', 'search#noresults', drupal_help_arg());
+ $this->assertTrue($output != '', "Module $module implements noresults help.");
+ }
+ }
}
class SearchBikeShed extends DrupalWebTestCase {
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.917
diff -u -r1.917 user.module
--- modules/user/user.module 21 Aug 2008 19:36:39 -0000 1.917
+++ modules/user/user.module 1 Sep 2008 20:12:19 -0000
@@ -1875,6 +1875,12 @@
', array('@permissions' => url('admin/user/permissions')));
case 'admin/user/search':
return '' . t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username or e-mail address. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda@example.com".') . '
';
+ case 'search#noresults':
+ $noresults = array(
+ t('Check if your spelling is correct.'),
+ t('Note that search user only looks for the Drupal user name or the user's email address and not the user\'s full name.'),
+ );
+ return theme('item_list', $noresults);
}
}