private function parseFacetsIntoObjects(SearchResultSet $resultSet)
    {
        // Make sure we can access the facet configuration
        if (!$resultSet->getUsedSearchRequest() || !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()) {
            return $resultSet;
        }

        // Read the response
        $response = $resultSet->getResponse();
        if (!is_object($response->facet_counts) && !is_object($response->facets)) {
            return $resultSet;
        }

        /** @var FacetRegistry $facetRegistry */
        $facetRegistry = $this->getFacetRegistry();
        $facetsConfiguration = $resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingFacets();

        foreach ($facetsConfiguration as $name => $options) {
            if (!is_array($options)) {
                continue;
            }
            $facetName = rtrim($name, '.');
            $type = !empty($options['type']) ? $options['type'] : '';

            $parser = $facetRegistry->getPackage($type)->getParser();
            $facet = $parser->parse($resultSet, $facetName, $options);
            if ($facet !== null) {
                $resultSet->addFacet($facet);
            }
        }

        $this->applyRequirements($resultSet);

        return $resultSet;
    }
private function parseFacetsIntoObjects(SearchResultSet $resultSet)
    {
        // Make sure we can access the facet configuration
        if (!$resultSet->getUsedSearchRequest() || !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()) {
            return $resultSet;
        }

        // Read the response
        $response = $resultSet->getResponse();
        if (!is_object($response->facet_counts) && !is_object($response->facets)) {
            return $resultSet;
        }

        /** @var FacetRegistry $facetRegistry */
        $facetRegistry = $this->getFacetRegistry();
        $facetsConfiguration = $resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingFacets();

        foreach ($facetsConfiguration as $name => $options) {
            if (!is_array($options)) {
                continue;
            }
            $facetName = rtrim($name, '.');
            $type = !empty($options['type']) ? $options['type'] : '';

            $parser = $facetRegistry->getPackage($type)->getParser();
            $facet = $parser->parse($resultSet, $facetName, $options);
            if ($facet !== null) {
                $resultSet->addFacet($facet);
            }
        }

        $this->applyRequirements($resultSet);

        return $resultSet;
    }
private function parseFacetsIntoObjects ( SearchResultSet $ resultSet ) { // Make sure we can access the facet configuration if ( ! $ resultSet -> getUsedSearchRequest ( ) || ! $ resultSet -> getUsedSearchRequest ( ) -> getContextTypoScriptConfiguration ( ) ) { return $ resultSet ; } // Read the response $ response = $ resultSet -> getResponse ( ) ; if ( ! is_object ( $ response -> facet_counts ) && ! is_object ( $ response -> facets ) ) { return $ resultSet ; } /** @var FacetRegistry $facetRegistry */ $ facetRegistry = $ this -> getFacetRegistry ( ) ; $ facetsConfiguration = $ resultSet -> getUsedSearchRequest ( ) -> getContextTypoScriptConfiguration ( ) -> getSearchFacetingFacets ( ) ; foreach ( $ facetsConfiguration as $ name => $ options ) { if ( ! is_array ( $ options ) ) { continue ; } $ facetName = rtrim ( $ name , '.' ) ; $ type = ! empty ( $ options [ 'type' ] ) ? $ options [ 'type' ] : '' ; $ parser = $ facetRegistry -> getPackage ( $ type ) -> getParser ( ) ; $ facet = $ parser -> parse ( $ resultSet , $ facetName , $ options ) ; if ( $ facet !== null ) { $ resultSet -> addFacet ( $ facet ) ; } } $ this -> applyRequirements ( $ resultSet ) ; return $ resultSet ; }
Parse available facets into objects

@param SearchResultSet $resultSet
@return SearchResultSet
Parse available facets into objects