protected function buildFacetingParameters($allFacets, TypoScriptConfiguration $typoScriptConfiguration)
    {
        $facetParameters = [];

        foreach ($allFacets as $facetName => $facetConfiguration) {
            $facetName = substr($facetName, 0, -1);
            $type = isset($facetConfiguration['type']) ? $facetConfiguration['type'] : 'options';
            $facetParameterBuilder = $this->facetRegistry->getPackage($type)->getQueryBuilder();

            if (is_null($facetParameterBuilder)) {
                throw new \InvalidArgumentException('No query build configured for facet ' . htmlspecialchars($facetName));
            }

            $facetParameters = array_merge_recursive($facetParameters, $facetParameterBuilder->build($facetName, $typoScriptConfiguration));
        }

        return $facetParameters;
    }