--- ezfezpsolrquerybuilder.php	2011-12-06 19:40:30.264838434 +0000
+++ ezfezpsolrquerybuilder_1.php	2011-12-06 19:40:41.853053265 +0000
@@ -1051,7 +1051,7 @@
      * @param array Parameter list array
      *
      * @return array List of Facet query parameter. The facet parameter corrosponds to
-     * the parameters defined here : http://wiki.apache.org/solr/SimpleFacetParameters
+     * the parameters defined here : http://wiki.apache.org/solr/SimpleFacetParametersurl
      */
     protected function buildFacetQueryParamList( $parameterList )
     {
@@ -1070,7 +1070,8 @@
                  empty( $facetDefinition['query'] ) and
                  empty( $facetDefinition['date'] ) )
             {
-                eZDebug::writeDebug( 'No facet field or query provided.', __METHOD__ );
+                eZDebug::writeDebug( 'No facet field or query provided.', 
+                                    'ezfeZPSolrQueryBuilder::buildFacetQueryParamList()' );
                 continue;
             }
 
@@ -1081,32 +1082,32 @@
                 {
                     case 'author':
                     {
-                        $queryPart['field'] = eZSolr::getMetaFieldName( 'owner_id', 'facet' );
+                        $queryPart['field'] = eZSolr::getMetaFieldName( 'owner_id' );
                     } break;
 
                     case 'class':
                     {
-                        $queryPart['field'] = eZSolr::getMetaFieldName( 'contentclass_id', 'facet' );
+                        $queryPart['field'] = eZSolr::getMetaFieldName( 'contentclass_id' );
                     } break;
 
                     case 'installation':
                     {
-                        $queryPart['field'] = eZSolr::getMetaFieldName( 'installation_id', 'facet' );
+                        $queryPart['field'] = eZSolr::getMetaFieldName( 'installation_id' );
                     } break;
 
                     case 'translation':
                     {
-                        $queryPart['field'] = eZSolr::getMetaFieldName( 'language_code', 'facet' );
+                        $queryPart['field'] = eZSolr::getMetaFieldName( 'language_code' );
                     } break;
 
                     default:
                     {
-                        $fieldName = eZSolr::getFieldName( $facetDefinition['field'], false, 'facet' );
+                        $fieldName = eZSolr::getFieldName( $facetDefinition['field'] );
                         if ( !$fieldName and empty( $facetDefinition['date'] ) )
                         {
                             eZDebug::writeNotice( 'Facet field does not exist in local installation, but may still be valid: ' .
                                                   $facetDefinition['field'],
-                                                  __METHOD__ );
+                                    'ezfeZPSolrQueryBuilder::buildFacetQueryParamList()' );
                             continue;
                         }
                         $queryPart['field'] = $fieldName;
@@ -1117,17 +1118,17 @@
             // Get query part.
             if ( !empty( $facetDefinition['query'] ) )
             {
-                list( $field, $query ) = explode( ':', $facetDefinition['query'], 2 );
+                list( $field, $query ) = explode( ':', $facetDefinition['query'] );
 
-                $field = eZSolr::getFieldName( $field, false, 'facet' );
+                $field = eZSolr::getFieldName( $field );
                 if ( !$field )
                 {
                     eZDebug::writeNotice( 'Invalid query field provided: ' . $facetDefinition['query'],
-                                          __METHOD__ );
+                                        'ezfeZPSolrQueryBuilder::buildFacetQueryParamList()' );
                     continue;
                 }
 
-                $queryPart['query'] = $field . ':' . $this->escapeQuery( $query );
+                $queryPart['query'] = $field . ':' . $query;
             }
 
             // Get prefix.
@@ -1154,13 +1155,13 @@
                     default:
                     {
                         eZDebug::writeWarning( 'Invalid sort option provided: ' . $facetDefinition['sort'],
-                                               __METHOD__ );
+                                              'ezfeZPSolrQueryBuilder::buildFacetQueryParamList()' );
                     } break;
                 }
             }
 
             // Get limit option
-            if ( !empty( $facetDefinition['limit'] ) )
+            if ( strlen( $facetDefinition['limit'] ) && is_numeric( $facetDefinition['limit'] ) )
             {
                 $queryPart['limit'] = $facetDefinition['limit'];
             }
@@ -1170,7 +1171,7 @@
             }
 
             // Get offset
-            if ( !empty( $facetDefinition['offset'] ) )
+            if ( isset( $facetDefinition['offset'] ) && is_numeric( $facetDefinition['offset'] ) )
             {
                 $queryPart['offset'] = $facetDefinition['offset'];
             }
@@ -1180,7 +1181,7 @@
             }
 
             // Get mincount
-            if ( !empty( $facetDefinition['mincount'] ) )
+            if ( isset( $facetDefinition['mincount'] ) && is_numeric( $facetDefinition['mincount'] ) )
             {
                 $queryPart['mincount'] = $facetDefinition['mincount'];
             }
@@ -1198,12 +1199,12 @@
             // Get date start option - may add validation later.
             if ( !empty( $facetDefinition['date'] ) )
             {
-                $fieldName = eZSolr::getFieldName( $facetDefinition['date'], false, 'facet' );
+                $fieldName = eZSolr::getFieldName( $facetDefinition['date'] );
                 if ( !$fieldName )
                 {
                     eZDebug::writeNotice( 'Facet field does not exist in local installation, but may still be valid: ' .
                                           $facetDefinition['date'],
-                                          __METHOD__ );
+                                        'ezfeZPSolrQueryBuilder::buildFacetQueryParamList()' );
                     continue;
                 }
                 else
@@ -1254,31 +1255,30 @@
                     default:
                     {
                         eZDebug::writeWarning( 'Invalid option gived for date.other: ' . $facetDefinition['date.other'],
-                                               __METHOD__ );
+                                              'ezfeZPSolrQueryBuilder::buildFacetQueryParamList()' );
                     } break;
                 }
             }
 
-            if ( !empty( $queryPart ) )
+            if ( count( $queryPart ) )
             {
+                $baseKeys = array( 'field', 'query', 'date' );
+
                 foreach ( $queryPart as $key => $value )
                 {
-                    /*if ( !empty( $queryParamList['facet.' . $key] ) and
-                         isset( $queryPart['field'] ) )
+                    if ( isset( $queryPart['field'] ) && !in_array( $key, $baseKeys ) )
                     {
-                        // local override for one given facet
                         $queryParamList['f.' . $queryPart['field'] . '.facet.' . $key][] = $value;
                     }
                     else
-                    {*/
-                        // global value
+                    {
                         $queryParamList['facet.' . $key][] = $value;
-                    /*}*/
+                    }
                 }
             }
         }
 
-        if ( !empty( $queryParamList ) )
+        if ( count( $queryParamList ) )
         {
             $queryParamList['facet'] = 'true';
         }
