Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.350
diff -u -p -r1.350 menu.inc
--- includes/menu.inc	9 Oct 2009 08:02:24 -0000	1.350
+++ includes/menu.inc	9 Oct 2009 19:02:45 -0000
@@ -699,6 +699,13 @@ function menu_tail_to_arg($arg, $map, $i
 }
 
 /**
+ * Return the entirety of the tail as an argument.
+ */
+function menu_tail_load($arg, $map, $index) {
+  return implode('/', array_slice($map, $index));
+}
+
+/**
  * This function is similar to _menu_translate() but does link-specific
  * preparation such as always calling to_arg functions
  *
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.319
diff -u -p -r1.319 search.module
--- modules/search/search.module	9 Oct 2009 01:00:02 -0000	1.319
+++ modules/search/search.module	9 Oct 2009 19:02:46 -0000
@@ -222,9 +222,10 @@ function search_menu() {
       $items['search/' . $search_hooks[$module]['path'] . '/%menu_tail'] = array(
         'title' => $search_hooks[$module]['title'],
         'page callback' => 'search_view',
-        'page arguments' => array($module),
+        'page arguments' => array($module, 2),
         'access callback' => '_search_menu_access',
         'access arguments' => array($module),
+        'load arguments' => array('%map', '%index'),
         'type' => MENU_LOCAL_TASK,
         'file' => 'search.pages.inc',
       );
@@ -802,16 +803,19 @@ function search_expression_insert($keys,
 /**
  * Helper function for grabbing search keys.
  */
-function search_get_keys() {
-  static $return;
-  if (!isset($return)) {
-    // Extract keys as remainder of path
-    // Note: support old GET format of searches for existing links.
-    $path = explode('/', $_GET['q'], 3);
-    $keys = empty($_REQUEST['keys']) ? '' : $_REQUEST['keys'];
-    $return = count($path) == 3 ? $path[2] : $keys;
+function search_get_keys($keys) {
+  // If the keys came in from the URL as an argument, use that first.
+  if ($keys) {
+    return $keys;
   }
-  return $return;
+
+  // If they came in as a query or post parameter, use that.
+  if (!empty($_REQUEST['keys'])) {
+    return $_REQUEST['keys'];
+  }
+
+  // Otherwise, punt.
+  return '';
 }
 
 /**
Index: modules/search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.12
diff -u -p -r1.12 search.pages.inc
--- modules/search/search.pages.inc	9 Oct 2009 01:00:03 -0000	1.12
+++ modules/search/search.pages.inc	9 Oct 2009 19:02:46 -0000
@@ -9,7 +9,7 @@
 /**
  * Menu callback; presents the search form and/or search results.
  */
-function search_view($type = 'node') {
+function search_view($type = 'node', $keys = '') {
   // 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
@@ -21,7 +21,7 @@ function search_view($type = 'node') {
       drupal_goto('search/node');
     }
 
-    $keys = search_get_keys();
+    $keys = search_get_keys($keys);
     // Only perform search if there is non-whitespace search term:
     $results = '';
     if (trim($keys)) {
@@ -43,7 +43,7 @@ function search_view($type = 'node') {
     }
   }
 
-  return drupal_get_form('search_form', NULL, empty($keys) ? '' : $keys, $type);
+  return drupal_get_form('search_form', NULL, $keys, $type);
 }
 
 /**
