? SolrPhpClient
Index: Solr_Base_Query.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Solr_Base_Query.php,v
retrieving revision 1.1.4.28
diff -u -F^function -r1.1.4.28 Solr_Base_Query.php
--- Solr_Base_Query.php	16 Apr 2009 15:26:44 -0000	1.1.4.28
+++ Solr_Base_Query.php	20 Apr 2009 23:43:48 -0000
@@ -83,9 +83,14 @@
   protected $subqueries = array();
 
   /**
-   * The query path (search keywords).
+   * The search keywords.
    */
-  protected $querypath;
+  protected $keys;
+
+  /**
+   * The search base path.
+   */
+  protected $base_path;
 
   /**
    * Apache_Solr_Service object
@@ -96,24 +101,39 @@
 
   /**
    * @param $solr
-   *  An instantiated Apache_Solr_Service Object.
-   *  Can be instantiated from apachesolr_get_solr().
+   *   An instantiated Apache_Solr_Service Object.
+   *   Can be instantiated from apachesolr_get_solr().
    *
-   * @param $querypath
+   * @param $keys
    *   The string that a user would type into the search box. Suitable input
-   *   may come from search_get_keys()
+   *   may come from search_get_keys().
    *
    * @param $filterstring
    *   Key and value pairs that are applied as a filter query.
    *
    * @param $sortstring
    *   Visible string telling solr how to sort - added to output querystring.
+   *
+   * @param $base_path
+   *   The search base path (without the keywords) for this query. If left
+   *   empty, it will get inferred from $_GET['q'].
    */
-  function __construct($solr, $querypath, $filterstring, $sortstring) {
+  function __construct($solr, $keys, $filterstring, $sortstring, $base_path) {
     $this->solr = $solr;
-    $this->querypath = trim($querypath);
+    $this->keys = trim($keys);
     $this->filterstring = trim($filterstring);
     $this->solrsort = trim($sortstring);
+    if (empty($base_path)) {
+      if (empty($keys)) {
+        $this->base_path = $_GET['q'];
+      }
+      else {
+        $this->base_path = substr($_GET['q'], 0, strpos($_GET['q'], '/' . $keys));
+      }
+    }
+    else {
+      $this->base_path = $base_path;
+    }
     $this->id = ++self::$idCount;
     $this->parse_filters();
     $this->available_sorts = $this->default_sorts();
@@ -271,17 +291,16 @@
   }
   
   /**
-   * return the search path
-   * this class assumes its always through the search api
+   * Return the search path.
    *
    * @param string $new_keywords
-   * if we are using new keywords as our query string
+   *   Optional. When set, this string overrides the query's current keywords.
    */
   public function get_path($new_keywords = NULL) {
     if ($new_keywords) {
-      return 'search/' . arg(1) . '/' . $new_keywords;
+      return $this->base_path . '/' . $new_keywords;
     }
-    return 'search/' . arg(1) . '/' . $this->get_query_basic();
+    return $this->base_path . '/' . $this->get_query_basic();
   }
 
   /**
@@ -385,7 +404,7 @@
   }
 
   protected function rebuild_query() {
-    $query = $this->querypath;
+    $query = $this->keys;
     foreach ($this->subqueries as $id => $data) {
       $operator = $data['#q_operator'];
       $subquery = $data['#query']->get_query_basic();
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.130
diff -u -F^function -r1.1.2.12.2.130 apachesolr.module
--- apachesolr.module	16 Apr 2009 18:11:30 -0000	1.1.2.12.2.130
+++ apachesolr.module	20 Apr 2009 23:43:49 -0000
@@ -933,14 +933,26 @@ function apachesolr_static_response_cach
 /**
  * Factory function for query objects.
  *
- * The query object is built from the keys, filters, and sort.
+ * @param $keys
+ *   The string that a user would type into the search box. Suitable input
+ *   may come from search_get_keys().
+ *
+ * @param $filters
+ *   Key and value pairs that are applied as a filter query.
+ *
+ * @param $solrsort
+ *   Visible string telling solr how to sort.
+ *
+ * @param $base_path
+ *   The search base path (without the keywords) for this query. If left
+ *   empty, it will get inferred from $_GET['q'].
  */
-function apachesolr_drupal_query($keys = '', $filters = '', $solrsort = '') {
+function apachesolr_drupal_query($keys = '', $filters = '', $solrsort = '', $base_path = '') {
   list($module, $class) = variable_get('apachesolr_query_class', array('apachesolr', 'Solr_Base_Query'));
   include_once drupal_get_path('module', $module) .'/'. $class .'.php';
-
+  
   try {
-    $query = new $class(apachesolr_get_solr(), $keys, $filters, $solrsort);
+    $query = new $class(apachesolr_get_solr(), $keys, $filters, $solrsort, $base_path);
   }
   catch (Exception $e) {
     watchdog('Apache Solr', $e->getMessage(), NULL, WATCHDOG_ERROR);
@@ -1175,7 +1187,7 @@ function theme_apachesolr_sort_list($ite
   function add_filter($field, $value);
   
   /**
-   * return the search path
+   * Return the search path (including the search keywords).
    */
   function get_path();
   
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.85
diff -u -F^function -r1.1.2.6.2.85 apachesolr_search.module
--- apachesolr_search.module	16 Apr 2009 15:26:44 -0000	1.1.2.6.2.85
+++ apachesolr_search.module	20 Apr 2009 23:43:49 -0000
@@ -89,13 +89,13 @@ function apachesolr_search_search($op = 
     case 'search':
 
       try {
-        // This is the object that knows about the query coming from the user.
         if (empty($filters) && !empty($_GET['filters'])) {
           $filters = $_GET['filters'];
         }
         if (empty($solrsort) && !empty($_GET['solrsort'])) {
           $solrsort = $_GET['solrsort'];
         }
+        // This is the object that knows about the query coming from the user.
         $query = apachesolr_drupal_query($keys, $filters, $solrsort);
         if (empty($query)) {
           throw new Exception(t('Could not construct a Solr query in function apachesolr_search_search()'));
