Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.127
diff -u -p -r1.1.2.12.2.127 apachesolr.module
--- apachesolr.module	14 Apr 2009 00:12:18 -0000	1.1.2.12.2.127
+++ apachesolr.module	15 Apr 2009 20:49:41 -0000
@@ -1199,12 +1199,12 @@ function apachesolr_drupal_query($keys =
  * Static getter/setter for the current query
  */
 function apachesolr_current_query($query = NULL) {
-  static $query_obj = NULL;
-  if (!empty($query)) {
-    $query_obj = $query;
+  static $saved_query = NULL;
+  if (is_object($query)) {
+    $saved_query = clone $query;
   }
-  
-  return $query_obj;
+
+  return empty($saved_query) ? $saved_query : clone $saved_query;
 }
 
 /**
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.82
diff -u -p -r1.1.2.6.2.82 apachesolr_search.module
--- apachesolr_search.module	14 Apr 2009 00:12:18 -0000	1.1.2.6.2.82
+++ apachesolr_search.module	15 Apr 2009 20:49:41 -0000
@@ -251,14 +251,17 @@ function apachesolr_search_search($op = 
             }
           }
         }
-
+        
+        // cache the built query. Since all the built queries go through
+        // this process, all the hook_invocations will happen later
+        apachesolr_current_query($query);
+        
         // This hook allows modules to modify the query and params objects.
         apachesolr_modify_query($query, $params, 'apachesolr_search');
         if (!$query) {
           return array();
         }
-        apachesolr_current_query($query);
-
+        
         $response = $solr->search($query->get_query_basic(), $params['start'], $params['rows'], $params);
         // The response is cached so that it is accessible to the blocks and anything
         // else that needs it beyond the initial search.
