diff --git a/Solr_Base_Query.php b/Solr_Base_Query.php
index 74448f0..7d18375 100644
--- a/Solr_Base_Query.php
+++ b/Solr_Base_Query.php
@@ -1,6 +1,7 @@
 <?php
 
 class SolrFilterSubQuery {
+
   /**
    * Static shared by all instances, used to increment ID numbers.
    */
@@ -10,7 +11,6 @@ class SolrFilterSubQuery {
    * Each query/subquery will have a unique ID.
    */
   public $id;
-
   public $operator;
 
   /**
@@ -141,11 +141,12 @@ class SolrFilterSubQuery {
       $subfq = $subquery->rebuildFq();
       if ($subfq) {
         $operator = $subquery->operator;
-        $fq[] =  "(" . implode(" $operator ", $subfq) . ")";
+        $fq[] = "(" . implode(" $operator ", $subfq) . ")";
       }
     }
     return $fq;
   }
+
 }
 
 class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterface {
@@ -167,14 +168,13 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
   protected $solr;
   // The array keys must always be real Solr index fields.
   protected $available_sorts;
+
   /**
    * The query name is used to construct a searcher string. Typically something like 'apachesolr'
    */
   protected $name;
-
   // Makes sure we always have a valid sort.
   protected $solrsort = array('#name' => 'score', '#direction' => 'desc');
-
   // A flag to allow the search to be aborted.
   public $abort_search = FALSE;
 
@@ -231,7 +231,7 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
   }
 
   protected $single_value_params = array(
-    'q' => TRUE,    // http://wiki.apache.org/solr/SearchHandler#q
+    'q' => TRUE, // http://wiki.apache.org/solr/SearchHandler#q
     'q.op' => TRUE, // http://wiki.apache.org/solr/SearchHandler#q.op
     'q.alt' => TRUE, // http://wiki.apache.org/solr/SearchHandler#q
     'df' => TRUE,
@@ -242,6 +242,7 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
     'debugQuery' => TRUE,
     'start' => TRUE,
     'rows' => TRUE,
+    'stats' => TRUE,
     'facet' => TRUE,
     'facet.prefix' => TRUE,
     'facet.limit' => TRUE,
@@ -297,7 +298,7 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
     // For certain fields Solr prefers a comma separated list.
     foreach (array('fl', 'hl.fl', 'sort', 'mlt.fl') as $name) {
       if (isset($params[$name])) {
-        $params[$name]  = implode(',', $params[$name]);
+        $params[$name] = implode(',', $params[$name]);
       }
     }
     return $params;
@@ -406,7 +407,7 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
   }
 
   protected function parseSortString() {
-        // Substitute any field aliases with real field names.
+    // Substitute any field aliases with real field names.
     $sortstring = strtr($this->sortstring, $this->field_map);
     // Score is a special case - it's the default sort for Solr.
     if ('' == $sortstring || 'score desc' == $sortstring) {
@@ -417,7 +418,7 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
     else {
       // Validate and set sort parameter
       $fields = implode('|', array_keys($this->available_sorts));
-      if (preg_match('/^(?:('. $fields .') (asc|desc),?)+$/', $sortstring, $matches)) {
+      if (preg_match('/^(?:(' . $fields . ') (asc|desc),?)+$/', $sortstring, $matches)) {
         // We only use the last match.
         $this->solrsort['#name'] = $matches[1];
         $this->solrsort['#direction'] = $matches[2];
@@ -476,7 +477,7 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
       if (isset($this->field_map[$solrsort['#name']])) {
         $solrsort['#name'] = $this->field_map[$solrsort['#name']];
       }
-      $queryvalues['solrsort'] = $solrsort['#name'] .' '. $solrsort['#direction'];
+      $queryvalues['solrsort'] = $solrsort['#name'] . ' ' . $solrsort['#direction'];
     }
     else {
       // Return to default relevancy sort.
@@ -495,4 +496,5 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
   public function solr($method) {
     return $this->solr->$method();
   }
+
 }
diff --git a/apachesolr.info b/apachesolr.info
index 0da5613..6fd8342 100644
--- a/apachesolr.info
+++ b/apachesolr.info
@@ -13,6 +13,7 @@ files[] = Solr_Base_Query.php
 files[] = plugins/facetapi/adapter.inc
 files[] = plugins/facetapi/query_type_date.inc
 files[] = plugins/facetapi/query_type_term.inc
+files[] = plugins/facetapi/query_type_numeric_range.inc
 files[] = tests/Dummy_Solr.php
 files[] = tests/solr_index_and_search.test
 files[] = tests/solr_base_query.test
diff --git a/apachesolr.module b/apachesolr.module
index 0342abc..92c49ba 100644
--- a/apachesolr.module
+++ b/apachesolr.module
@@ -266,6 +266,12 @@ function apachesolr_facetapi_query_types() {
         'adapter' => 'apachesolr',
       ),
     ),
+    'apachesolr_numeric_range' => array(
+      'handler' => array(
+        'class' => 'ApacheSolrFacetapiNumericRange',
+        'adapter' => 'apachesolr',
+      ),
+    ),
   );
 }
 
@@ -293,6 +299,11 @@ function apachesolr_facetapi_facet_info($searcher_info) {
         if (!empty($field_info['facet missing allowed'])) {
           $facets[$field]['facet missing allowed'] = $field_info['facet missing allowed'];
         }
+        if (!empty($field_info['query types'])) {
+          $facets[$field]['query types'] = $field_info['query types'];
+        }
+        // TODO : This is actually deprecated but we should still support
+        // older versions of facetapi
         if (!empty($field_info['query type'])) {
           $facets[$field]['query type'] = $field_info['query type'];
         }
@@ -1577,6 +1588,7 @@ function apachesolr_do_query(DrupalSolrQueryInterface $current_query, $page = 0)
     // Gets enabled facets, adds filter queries to $params.
     $adapter = facetapi_adapter_load($searcher);
     if ($adapter) {
+      // Realm could be added but we want all the facets
       $adapter->addActiveFilters($current_query);
     }
   }
@@ -2241,14 +2253,17 @@ function field_apachesolr_field_mappings() {
       'map callback' => 'apachesolr_fields_list_facet_map_callback',
       'index_type' => 'integer',
       'facets' => TRUE,
+      'query types' => array('term', 'numeric_range'),
+      'query type' => 'term',
       'facet missing allowed' => TRUE,
-      'query type' => 'numeric_range',
     ),
     'list_float' => array(
       'indexing_callback' => 'apachesolr_fields_default_indexing_callback',
       'map callback' => 'apachesolr_fields_list_facet_map_callback',
       'index_type' => 'float',
       'facets' => TRUE,
+      'query types' => array('term', 'numeric_range'),
+      'query type' => 'term',
       'facet missing allowed' => TRUE,
     ),
     'list_text' => array(
@@ -2268,16 +2283,25 @@ function field_apachesolr_field_mappings() {
     'number_integer' => array(
       'indexing_callback' => 'apachesolr_fields_default_indexing_callback',
       'index_type' => 'tint',
+      'facets' => TRUE,
+      'query types' => array('term', 'numeric_range'),
+      'query type' => 'term',
       'facet mincount allowed' => TRUE,
     ),
     'number_decimal' => array(
       'indexing_callback' => 'apachesolr_fields_default_indexing_callback',
       'index_type' => 'tfloat',
+      'facets' => TRUE,
+      'query types' => array('term', 'numeric_range'),
+      'query type' => 'term',
       'facet mincount allowed' => TRUE,
     ),
     'number_float' => array(
       'indexing_callback' => 'apachesolr_fields_default_indexing_callback',
       'index_type' => 'tfloat',
+      'facets' => TRUE,
+      'query types' => array('term', 'numeric_range'),
+      'query type' => 'term',
       'facet mincount allowed' => TRUE,
     ),
     'taxonomy_term_reference' => array(
@@ -2303,6 +2327,7 @@ function date_apachesolr_field_mappings() {
     'indexing_callback' => 'apachesolr_date_default_indexing_callback',
     'index_type' => 'date',
     'facets' => TRUE,
+    'query types' => array('date'),
     'query type' => 'date',
     'min callback' => 'apachesolr_get_min_date',
     'max callback' => 'apachesolr_get_max_date',
diff --git a/plugins/facetapi/adapter.inc b/plugins/facetapi/adapter.inc
index 7d8f4a5..9471c23 100644
--- a/plugins/facetapi/adapter.inc
+++ b/plugins/facetapi/adapter.inc
@@ -100,7 +100,7 @@ class ApacheSolrFacetapiAdapter extends FacetapiAdapter {
   }
 
   /**
-   * Returns the nmber of total results found for the current search.
+   * Returns the number of total results found for the current search.
    */
   public function getResultCount() {
     $response = apachesolr_static_response_cache($this->getSearcher());
diff --git a/plugins/facetapi/query_type_numeric_range.inc b/plugins/facetapi/query_type_numeric_range.inc
new file mode 100644
index 0000000..b43ca88
--- /dev/null
+++ b/plugins/facetapi/query_type_numeric_range.inc
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ * @file
+ * Numeric range query type plugin for the Apache Solr adapter.
+ */
+
+/**
+ * Plugin for "numeric_range" query types.
+ */
+class ApacheSolrFacetapiNumericRange extends FacetapiQueryType implements FacetapiQueryTypeInterface {
+
+  /**
+   * Returns the query type associated with the plugin.
+   *
+   * @return string
+   *   The query type.
+   */
+  static public function getType() {
+    return 'numeric_range';
+  }
+
+  /**
+   * Adds the filter to the query object.
+   *
+   * @param DrupalSolrQueryInterface $query
+   *   An object containing the query in the backend's native API.
+   * @todo Cache the values based on the filter query or any other way?
+   */
+  public function execute($query) {
+    // Check if we have a cache of this field
+    //
+    $settings = $this->adapter->getFacet($this->facet)->getSettings();
+    $active = $this->adapter->getActiveItems($this->facet);
+    // See:  http://wiki.apache.org/solr/StatsComponent
+    $query->addParam('stats', 'true');
+    $query->addParam('stats.field', $this->facet['field']);
+    $query->addParam('stats.facet', $this->facet['field']);
+    // Range filters don't support OR operator.
+    foreach ($active as $value => $item) {
+      $query->addFilter($this->facet['field'], $value);
+    }
+  }
+
+  /**
+   * Initializes the facet's build array.
+   *
+   * @return array
+   *   The initialized render array.
+   */
+  public function build() {
+    $build = array();
+    if ($response = apachesolr_static_response_cache($this->adapter->getSearcher())) {
+
+      //we need an additional query for the statistics of the field
+      // We can optionally specify a Solr object.
+      $solr = apachesolr_get_solr();
+      $query_stats = apachesolr_drupal_query('apachesolr_stats', array(), '', '', $solr);
+      $query_stats->addParam('stats', 'true');
+      $query_stats->addParam('stats.field', $this->facet['field']);
+      $query_stats->addParam('stats.facet', $this->facet['field']);
+      $response_stats = $query_stats->search();
+      if ($response_stats->response) {
+        $stats_minmax = $response_stats->stats->stats_fields->{$this->facet['field']};
+      }
+
+      if (isset($response->stats->stats_fields->{$this->facet['field']})) {
+        $stats = (array) $response->stats->stats_fields->{$this->facet['field']};
+        foreach ($stats as $key => $val) {
+          $build[$this->facet['field']]['#range_' . $key] = $val;
+          $build[$this->facet['field']]['#global_range_' . $key] = $stats_minmax->$key;
+        }
+      }
+    }
+    return $build;
+  }
+}
