diff --git a/Solr_Base_Query.php b/Solr_Base_Query.php
index 71fc377..fdc914b 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];
@@ -469,7 +470,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.
@@ -488,4 +489,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 671df46..a067c89 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,8 +299,8 @@ 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 type'])) {
-          $facets[$field]['query type'] = $field_info['query type'];
+        if (!empty($field_info['query types'])) {
+          $facets[$field]['query types'] = $field_info['query types'];
         }
         if (!empty($field_info['min callback'])) {
           $facets[$field]['min callback'] = $field_info['min callback'];
@@ -1568,6 +1574,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);
     }
   }
@@ -2232,14 +2239,15 @@ function field_apachesolr_field_mappings() {
       'map callback' => 'apachesolr_fields_list_facet_map_callback',
       'index_type' => 'integer',
       'facets' => TRUE,
+      'query types' => array('term', 'numeric_range'),
       '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'),
       'facet missing allowed' => TRUE,
     ),
     'list_text' => array(
@@ -2259,16 +2267,22 @@ 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'),
       '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'),
       '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'),
       'facet mincount allowed' => TRUE,
     ),
     'taxonomy_term_reference' => array(
@@ -2294,7 +2308,7 @@ function date_apachesolr_field_mappings() {
     'indexing_callback' => 'apachesolr_date_default_indexing_callback',
     'index_type' => 'date',
     'facets' => TRUE,
-    'query type' => 'date',
+    'query types' => array('date'),
     'min callback' => 'apachesolr_get_min_date',
     'max callback' => 'apachesolr_get_max_date',
     'map callback' => 'facetapi_map_date',
