public function modifyQuery(Query $query)
    {
        $typoScriptConfiguration = $this->searchRequest->getContextTypoScriptConfiguration();
        $faceting = FacetingBuilder::fromTypoScriptConfiguration($typoScriptConfiguration);

        $allFacets = $typoScriptConfiguration->getSearchFacetingFacets();
        $facetParameters = $this->buildFacetingParameters($allFacets, $typoScriptConfiguration);
        foreach ($facetParameters as $facetParameter => $value) {
            if(strtolower($facetParameter) === 'facet.field') {
                $faceting->setFields($value);
            } else {
                $faceting->addAdditionalParameter($facetParameter, $value);
            }
        }

        $searchArguments = $this->searchRequest->getArguments();
        if (!is_array($searchArguments)) {
            return $query;
        }

        $keepAllFacetsOnSelection = $typoScriptConfiguration->getSearchFacetingKeepAllFacetsOnSelection();
        $facetFilters = $this->addFacetQueryFilters($searchArguments, $allFacets, $keepAllFacetsOnSelection);

        $queryBuilder = new QueryBuilder($typoScriptConfiguration);
        $queryBuilder->startFrom($query)->useFaceting($faceting)->useFilterArray($facetFilters);
        return $query;
    }
public function modifyQuery(Query $query)
    {
        $typoScriptConfiguration = $this->searchRequest->getContextTypoScriptConfiguration();
        $faceting = FacetingBuilder::fromTypoScriptConfiguration($typoScriptConfiguration);

        $allFacets = $typoScriptConfiguration->getSearchFacetingFacets();
        $facetParameters = $this->buildFacetingParameters($allFacets, $typoScriptConfiguration);
        foreach ($facetParameters as $facetParameter => $value) {
            if(strtolower($facetParameter) === 'facet.field') {
                $faceting->setFields($value);
            } else {
                $faceting->addAdditionalParameter($facetParameter, $value);
            }
        }

        $searchArguments = $this->searchRequest->getArguments();
        if (!is_array($searchArguments)) {
            return $query;
        }

        $keepAllFacetsOnSelection = $typoScriptConfiguration->getSearchFacetingKeepAllFacetsOnSelection();
        $facetFilters = $this->addFacetQueryFilters($searchArguments, $allFacets, $keepAllFacetsOnSelection);

        $queryBuilder = new QueryBuilder($typoScriptConfiguration);
        $queryBuilder->startFrom($query)->useFaceting($faceting)->useFilterArray($facetFilters);
        return $query;
    }
public function modifyQuery ( Query $ query ) { $ typoScriptConfiguration = $ this -> searchRequest -> getContextTypoScriptConfiguration ( ) ; $ faceting = FacetingBuilder :: fromTypoScriptConfiguration ( $ typoScriptConfiguration ) ; $ allFacets = $ typoScriptConfiguration -> getSearchFacetingFacets ( ) ; $ facetParameters = $ this -> buildFacetingParameters ( $ allFacets , $ typoScriptConfiguration ) ; foreach ( $ facetParameters as $ facetParameter => $ value ) { if ( strtolower ( $ facetParameter ) === 'facet.field' ) { $ faceting -> setFields ( $ value ) ; } else { $ faceting -> addAdditionalParameter ( $ facetParameter , $ value ) ; } } $ searchArguments = $ this -> searchRequest -> getArguments ( ) ; if ( ! is_array ( $ searchArguments ) ) { return $ query ; } $ keepAllFacetsOnSelection = $ typoScriptConfiguration -> getSearchFacetingKeepAllFacetsOnSelection ( ) ; $ facetFilters = $ this -> addFacetQueryFilters ( $ searchArguments , $ allFacets , $ keepAllFacetsOnSelection ) ; $ queryBuilder = new QueryBuilder ( $ typoScriptConfiguration ) ; $ queryBuilder -> startFrom ( $ query ) -> useFaceting ( $ faceting ) -> useFilterArray ( $ facetFilters ) ; return $ query ; }
Modifies the given query and adds the parameters necessary for faceted
search.

@param Query $query The query to modify
@return Query The modified query with faceting parameters
Modifies the given query and adds the parameters necessary for faceted search .