Index: apachesolr_views_query.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr_views/apachesolr_views_query.inc,v
retrieving revision 1.2
diff -u -p -r1.2 apachesolr_views_query.inc
--- apachesolr_views_query.inc	6 Apr 2009 21:33:47 -0000	1.2
+++ apachesolr_views_query.inc	20 Apr 2009 23:22:16 -0000
@@ -100,6 +100,19 @@ class apachesolr_views_query extends vie
     // We default to getting snippets from the body.
     $hl_fl = is_null($this->_params['hl.fl']) ? 'body' : $this->_params['hl.fl'];
     
+    // Add any filters from the querystring to the search facets
+    $querystring_filters = array();
+    if ($_GET['filters']) {
+      $querystring_filters = explode(' ', $_GET['filters']);
+    }
+    foreach($querystring_filters as $filterstring) {
+      $filter_data = explode(':', $filterstring);
+      $this->_facets[$filter_data[0]][] = array(
+        'value' => $filter_data[1],
+        'exclude' => 0,
+      );
+    }
+    
     $facet_query_limits = variable_get('apachesolr_facet_query_limits', array());
     // Request all enabled facets. And go fetch them
     // this is used so the blocks work..
@@ -491,6 +504,20 @@ class apachesolr_views_query extends vie
         }
       }
     }
+
+    //remove any views arguments from the list of facets
+    foreach ($this->_view_arguments as $field => $argument) {
+      unset($this->_facets[$field]);
+    }
+    //build remaining facets into the querystring
+    foreach ($this->_facets as $facet_name => $facets) {
+      foreach ($facets as $facet) {
+        if (!$facet['exclude']) {
+          $filters[] = $facet_name.':'.$facet['value'];
+        }
+      }
+    }
+    if ($filters) $query_string .= '&filters='.implode('+', $filters);
     
     return !empty($query_string) ? substr($query_string, 1) : NULL;
   }
@@ -509,14 +536,16 @@ class apachesolr_views_query extends vie
    *
    * Compabatiablity layer with Solr_Base_Query
    */
-  function get_filters() {
+  function get_filters($name = NULL) {
     $filters = array();
-    foreach ($this->_facets() as $type => $fields) {
+    foreach ($this->_facets as $type => $fields) {
       foreach ($fields as $data) {
-        $filters['#name'] = ($data['exclude']) ? "NOT $type" : $type;
-        $filters['#value'] = $data['value'];
+        $filter['#name'] = ($data['exclude']) ? "NOT $type" : $type;
+        $filter['#value'] = $data['value'];
+        $filters[] = $filter;
       }
     }
+    return $filters;
   }
   
   function get_fq() {
