/**
     * @param array $solrResult
     * @return array
     */
    public function facetResult( &$solrResult )
    {
        $translations = FacetFilteringTool::getTaxonomyTranslation ( $this->attribute );
        $result       = parent::facetResult($solrResult);

        //sorting
        $keysById = array();

        foreach ( $result as $k => $f )
            $keysById[$f['id']] = $k;

        $sortedResult = array();

        foreach($this->defaultValues as $id)
        {
            if( isset($keysById[$id]))
            {
                $visible = true;
                if (SolrSafeOperatorHelper::featureIsActive('Univadis18Redesign'))
                {
                    $hiddenValues = SolrSafeOperatorHelper::feature('Univadis18Redesign', 'SpecialtyFacetHiddenValues');
                    if (in_array($id, $hiddenValues)) {
                        $visible = false;
                    }
                }
                $f                              = $result[$keysById[$id]];
                $f['visible'] = $visible;
                $sortedResult[$keysById[$id]]   = $f;

            }
            else
            {
                if ( isset($translations[$id]) )
                {
                    $visible = true;
                    if (SolrSafeOperatorHelper::featureIsActive('Univadis18Redesign'))
                    {
                        $hiddenValues = SolrSafeOperatorHelper::feature('Univadis18Redesign', 'SpecialtyFacetHiddenValues');
                        if (in_array($id, $hiddenValues)) {
                            $visible = false;
                        }
                    }
                    $sortedResult[$translations[$id]] = array(
                        'count'    => 0,
                        'id'       => $id,
                        'checked'  => 0,
                        'visible' => $visible,
                    );
                }
            }
        }

        return $sortedResult;
    }
    /**
     * @return array
     */
    protected function allSpecialitiesFacet()
    {
        $facet          = new FacetFieldTag(1, 'Speciality', 'speciality');
        $facet->sort    = 'alpha';

        $params = array(   'indent'       => 'on',
                           'q'            => '',
                           'start'        => 0,
                           'rows'         => 1,
                           'fq'           => $this->solrFilter(),
                           'fl'           => 'meta_main_node_id_si',
                           'qt'           => 'ezpublish',
                           'explainOther' => '',
                           'hl.fl'        => '',
                           'facet'        => 'true',
        );

        $params         = $this->mergeFacetParams( $params , $facet->facetParams() );
        $solrResult     = SolrTool::rawSearch($params);
        $facetResult    = $facet->facetResult( $solrResult );
        $results        = array();

        foreach ( $facetResult as $kw => $v_arr )
        {
            $firstChar = '';
            if ( preg_match( '#^(.)#u', $kw, $matches ) )
                $firstChar = $matches[1];

            if( !preg_match("#\pL#u", $firstChar) )
                $firstChar = '#';

            if ( !isset( $results[$firstChar]) )
                $results[$firstChar] = array();

            $results[$firstChar][$kw] = $v_arr;
        }
        ksort($results);

        // We put the # values to the end
        if( isset($results['#']) )
        {
            $hashResults = $results['#'];
            unset($results['#']);
            $results['#'] = $hashResults;
        }

        // we rely on solr sort for the time being for the sub arrays

        return $results;
    }