diff --git a/modules/search.module b/modules/search.module
index dec843da3c4fe458a8f7f84aa864973049dfab2d..790fcca7738630dab3345bc274d865afde4e948a 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -339,13 +339,14 @@ function search_view($keys) {
         $output .= "<br />". $help_link ."<br />";
     }
 
-    // Log the search keys:
-    watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
+    // Only perform search if there is non-whitespace search term:
+    if (trim($keys)) {
+      // Log the search keys:
+      watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
 
-    // Collect the search results:
-    $results = search_data($keys);
+      // Collect the search results:
+      $results = search_data($keys);
 
-    if ($keys) {
       if ($results) {
         $output .= theme("box", t("Search Results"), $results);
       }
diff --git a/modules/search/search.module b/modules/search/search.module
index dec843da3c4fe458a8f7f84aa864973049dfab2d..790fcca7738630dab3345bc274d865afde4e948a 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -339,13 +339,14 @@ function search_view($keys) {
         $output .= "<br />". $help_link ."<br />";
     }
 
-    // Log the search keys:
-    watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
+    // Only perform search if there is non-whitespace search term:
+    if (trim($keys)) {
+      // Log the search keys:
+      watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
 
-    // Collect the search results:
-    $results = search_data($keys);
+      // Collect the search results:
+      $results = search_data($keys);
 
-    if ($keys) {
       if ($results) {
         $output .= theme("box", t("Search Results"), $results);
       }