? .svn
? SolrPhpClient
? contrib/.svn
? contrib/apachesolr_image/.svn
? contrib/apachesolr_nodeaccess/.svn
? contrib/apachesolr_nodeaccess/tests/.svn
? contrib/apachesolr_og/.svn
? tests/.svn
Index: Solr_Base_Query.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Solr_Base_Query.php,v
retrieving revision 1.1.4.38
diff -w -u -p -r1.1.4.38 Solr_Base_Query.php
--- Solr_Base_Query.php	30 Jun 2009 10:57:23 -0000	1.1.4.38
+++ Solr_Base_Query.php	1 Jul 2009 14:24:17 -0000
@@ -114,7 +114,7 @@ class Solr_Base_Query implements Drupal_
    *   Key and value pairs that are applied as filter queries.
    *
    * @param $sortstring
-   *   Visible string telling solr how to sort - added to output querystring.
+   *   Visible string telling solr how to sort - added to GET query params.
    *
    * @param $base_path
    *   The search base path (without the keywords) for this query.
@@ -263,17 +263,17 @@ class Solr_Base_Query implements Drupal_
   }
 
   /**
-   * Return filters and sort in a form suitable for a query param to url().
+   * Return filters and sort in a form suitable for a $options['query'] param to url().
    */
-  public function get_url_querystring() {
-    $querystring = '';
+  public function get_url_queryvalues() {
+    $queryvalues = array();
     if ($fq = $this->rebuild_fq(TRUE)) {
-      $querystring = 'filters='. rawurlencode(implode(' ', $fq));
+      $queryvalues['filters'] = implode(' ', $fq);
     }
     if ($this->solrsort) {
-      $querystring .= ($querystring ? '&' : '') .'solrsort='. rawurlencode($this->solrsort);
+      $queryvalues['solrsort'] = $this->solrsort;
     }
-    return $querystring;
+    return $queryvalues;
   }
 
   public function get_fq() {
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.150
diff -w -u -p -r1.1.2.12.2.150 apachesolr.module
--- apachesolr.module	30 Jun 2009 10:57:24 -0000	1.1.2.12.2.150
+++ apachesolr.module	1 Jul 2009 14:24:17 -0000
@@ -588,7 +588,7 @@ function apachesolr_block($op = 'list', 
           $sort_links[$type] = array(
             'name' => $sort['name'],
             'path' => $path,
-            'options' => array('query' => $new_query->get_url_querystring()),
+            'options' => array('query' => $new_query->get_url_queryvalues()),
             'active' => $active,
             'direction' => $direction
           );
@@ -653,12 +653,12 @@ function apachesolr_facet_block($respons
         // '*' sorts before all numbers.
         $sortpre = '*';
         $new_query->remove_filter($facet_field, $facet);
-        $options['query'] = $new_query->get_url_querystring();
+        $options['query'] = $new_query->get_url_queryvalues();
         $link = theme('apachesolr_unclick_link', $facet_text, $new_query->get_path(), $options);
       }
       else {
         $new_query->add_filter($facet_field, $facet, $exclude);
-        $options['query'] = $new_query->get_url_querystring();
+        $options['query'] = $new_query->get_url_queryvalues();
         $link = theme('apachesolr_facet_link', $facet_text, $new_query->get_path(), $options, $count, $active, $response->response->numFound);
       }
       if ($count || $active) {
@@ -697,7 +697,7 @@ function apachesolr_date_facet_block($re
     else {
       $facet_text = apachesolr_date_format_iso_by_gap(apachesolr_date_find_query_gap($filter['#start'], $filter['#end']), $filter['#start']);
     }
-    $options['query'] = $new_query->get_url_querystring();
+    $options['query'] = $new_query->get_url_queryvalues();
     array_unshift($items, theme('apachesolr_unclick_link', $facet_text, $new_query->get_path(), $options));
   }
   // Add links for additional date filters.
@@ -735,7 +735,7 @@ function apachesolr_date_facet_block($re
       }
       $new_query = clone $query;
       $new_query->add_filter($facet_field, '['. $facet .' TO '. $range_end[$facet] .']');
-      $options['query'] = $new_query->get_url_querystring();
+      $options['query'] = $new_query->get_url_queryvalues();
       $items[] = theme('apachesolr_facet_link', $facet_text, $new_query->get_path(), $options, $count, FALSE, $response->response->numFound);
     }
   }
@@ -1322,7 +1322,6 @@ function theme_apachesolr_mlt_recommenda
 }
 
 function theme_apachesolr_facet_link($facet_text, $path, $options = array(), $count, $active = FALSE, $num_found = NULL) {
-
   if ($active) {
     if (isset($options['attributes']['class'])) {
       $options['attributes']['class'] .= ' active';
@@ -1335,7 +1334,10 @@ function theme_apachesolr_facet_link($fa
 }
 
 /**
- * A replacement for l() - very similar but doesn't add the 'active' class.
+ * A replacement for l()
+ *  - doesn't add the 'active' class
+ *  - retains all $_GET parameters that ApacheSolr may not be aware of
+ *  - if set, $options['query'] MUST be an array
  *
  * @see http://api.drupal.org/api/function/l/6 for parameters and options.
  *
@@ -1347,13 +1349,24 @@ function apachesolr_l($text, $path, $opt
   $options += array(
     'attributes' => array(),
     'html' => FALSE,
+    'query' => array(),
   );
+
   // Don't need this, and just to be safe.
   unset($options['attributes']['title']);
   // Double encode + characters for clean URL Apache quirks.
   if (variable_get('clean_url', '0')) {
     $path = str_replace('+', '%2B', $path);
   }
+
+  // Retain GET parameters that ApacheSolr knows nothing about.
+  $diff = array_merge($_GET, $options['query']);
+  unset($diff['q']);
+  unset($diff['filters']);
+  foreach ($diff as $key => $value) {
+    $options['query'][$key] = $value;
+  }
+
   return '<a href="'. check_url(url($path, $options)) .'"'. drupal_attributes($options['attributes']) .'>'. ($options['html'] ? $text : check_plain($text)) .'</a>';
 }
 
@@ -1460,11 +1473,11 @@ interface Drupal_Solr_Query_Interface {
   function get_path();
 
   /**
-   * Return any query string for use in the l function.
+   * Return an array of parameters for use in the l function.
    *
    * @see l()
    */
-  function get_url_querystring();
+  function get_url_queryvalues();
 
   /**
    * return the basic string query
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.107
diff -w -u -p -r1.1.2.6.2.107 apachesolr_search.module
--- apachesolr_search.module	30 Jun 2009 15:10:47 -0000	1.1.2.6.2.107
+++ apachesolr_search.module	1 Jul 2009 14:24:17 -0000
@@ -589,12 +589,12 @@ function apachesolr_search_block($op = '
               if ($active = $query->has_filter('tid', $tid)) {
                 $contains_active = TRUE;
                 $new_query->remove_filter('tid', $term->tid);
-                $options['query'] = $new_query->get_url_querystring();
+                $options['query'] = $new_query->get_url_queryvalues();
                 $link = theme('apachesolr_unclick_link', $term->name, $new_query->get_path(), $options);
               }
               else {
                 $new_query->add_filter('tid', $term->tid);
-                $options['query'] = $new_query->get_url_querystring();
+                $options['query'] = $new_query->get_url_queryvalues();
                 $link = theme('apachesolr_facet_link', $term->name, $new_query->get_path(), $options, $count, $active, $response->response->numFound);
               }
               $countsort = $count == 0 ? '' : 1 / $count;
@@ -630,7 +630,7 @@ function apachesolr_search_block($op = '
               if ($field['#name']) {
                 $new_query = clone $query;
                 $new_query->remove_filter($field['#name'], $field['#value']);
-                $options['query'] = $new_query->get_url_querystring();
+                $options['query'] = $new_query->get_url_queryvalues();
                 $fielddisplay = theme("apachesolr_breadcrumb_". $field['#name'], $field['#value']);
                 if (!$fielddisplay) {
                   $fielddisplay = $field['#value'];
@@ -777,7 +777,7 @@ function apachesolr_search_form_search_f
     $querystring = '';
     if ($apachesolr_has_searched) {
       $query = apachesolr_current_query();
-      $querystring = $query->get_url_querystring();
+      $querystring = $query->get_url_queryvalues();
     }
 
     $form['basic']['apachesolr_search']['#tree'] = TRUE;
