private function computeQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText)
    {
        $config   = $this->getConfig($containerConfig);
        $storeId  = $containerConfig->getStoreId();
        $rewrites = [];
        $maxRewrites = $config->getMaxRewrites();

        if ($config->isSynonymSearchEnabled()) {
            $thesaurusType   = ThesaurusInterface::TYPE_SYNONYM;
            $synonymRewrites = $this->getSynonymRewrites($storeId, $queryText, $thesaurusType, $maxRewrites);
            $rewrites        = $this->getWeightedRewrites($synonymRewrites, $config->getSynonymWeightDivider());
        }

        if ($config->isExpansionSearchEnabled()) {
            $synonymRewrites = array_merge([$queryText => 1], $rewrites);

            foreach ($synonymRewrites as $currentQueryText => $currentWeight) {
                $thesaurusType     = ThesaurusInterface::TYPE_EXPANSION;
                $expansions        = $this->getSynonymRewrites($storeId, $currentQueryText, $thesaurusType, $maxRewrites);
                $expansionRewrites = $this->getWeightedRewrites($expansions, $config->getExpansionWeightDivider(), $currentWeight);
                $rewrites          = array_merge($rewrites, $expansionRewrites);
            }
        }

        return $rewrites;
    }
private function computeQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText)
    {
        $config   = $this->getConfig($containerConfig);
        $storeId  = $containerConfig->getStoreId();
        $rewrites = [];
        $maxRewrites = $config->getMaxRewrites();

        if ($config->isSynonymSearchEnabled()) {
            $thesaurusType   = ThesaurusInterface::TYPE_SYNONYM;
            $synonymRewrites = $this->getSynonymRewrites($storeId, $queryText, $thesaurusType, $maxRewrites);
            $rewrites        = $this->getWeightedRewrites($synonymRewrites, $config->getSynonymWeightDivider());
        }

        if ($config->isExpansionSearchEnabled()) {
            $synonymRewrites = array_merge([$queryText => 1], $rewrites);

            foreach ($synonymRewrites as $currentQueryText => $currentWeight) {
                $thesaurusType     = ThesaurusInterface::TYPE_EXPANSION;
                $expansions        = $this->getSynonymRewrites($storeId, $currentQueryText, $thesaurusType, $maxRewrites);
                $expansionRewrites = $this->getWeightedRewrites($expansions, $config->getExpansionWeightDivider(), $currentWeight);
                $rewrites          = array_merge($rewrites, $expansionRewrites);
            }
        }

        return $rewrites;
    }
private function computeQueryRewrites ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ config = $ this -> getConfig ( $ containerConfig ) ; $ storeId = $ containerConfig -> getStoreId ( ) ; $ rewrites = [ ] ; $ maxRewrites = $ config -> getMaxRewrites ( ) ; if ( $ config -> isSynonymSearchEnabled ( ) ) { $ thesaurusType = ThesaurusInterface :: TYPE_SYNONYM ; $ synonymRewrites = $ this -> getSynonymRewrites ( $ storeId , $ queryText , $ thesaurusType , $ maxRewrites ) ; $ rewrites = $ this -> getWeightedRewrites ( $ synonymRewrites , $ config -> getSynonymWeightDivider ( ) ) ; } if ( $ config -> isExpansionSearchEnabled ( ) ) { $ synonymRewrites = array_merge ( [ $ queryText => 1 ] , $ rewrites ) ; foreach ( $ synonymRewrites as $ currentQueryText => $ currentWeight ) { $ thesaurusType = ThesaurusInterface :: TYPE_EXPANSION ; $ expansions = $ this -> getSynonymRewrites ( $ storeId , $ currentQueryText , $ thesaurusType , $ maxRewrites ) ; $ expansionRewrites = $ this -> getWeightedRewrites ( $ expansions , $ config -> getExpansionWeightDivider ( ) , $ currentWeight ) ; $ rewrites = array_merge ( $ rewrites , $ expansionRewrites ) ; } } return $ rewrites ; }
Compute weigthed rewrites for the query.

@param ContainerConfigurationInterface $containerConfig Search request container config.
@param string                          $queryText       Fulltext query.

@return array
Compute weigthed rewrites for the query .