private function getSpellcheckedQuery(ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost)
    {
        $query = null;

        $relevanceConfig = $containerConfig->getRelevanceConfig();
        $queryClauses = [];

        if ($relevanceConfig->isFuzzinessEnabled()) {
            $queryClauses[] = $this->getFuzzyQuery($containerConfig, $queryText);
        }

        if ($relevanceConfig->isPhoneticSearchEnabled()) {
            $queryClauses[] = $this->getPhoneticQuery($containerConfig, $queryText);
        }

        if (!empty($queryClauses)) {
            $queryParams = ['should' => $queryClauses, 'boost' => $boost];

            if ($spellingType == SpellcheckerInterface::SPELLING_TYPE_MOST_FUZZY) {
                $queryParams['must'] = [$this->getWeightedSearchQuery($containerConfig, $queryText)];
            }

            $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, $queryParams);
        }

        return $query;
    }
private function getSpellcheckedQuery(ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost)
    {
        $query = null;

        $relevanceConfig = $containerConfig->getRelevanceConfig();
        $queryClauses = [];

        if ($relevanceConfig->isFuzzinessEnabled()) {
            $queryClauses[] = $this->getFuzzyQuery($containerConfig, $queryText);
        }

        if ($relevanceConfig->isPhoneticSearchEnabled()) {
            $queryClauses[] = $this->getPhoneticQuery($containerConfig, $queryText);
        }

        if (!empty($queryClauses)) {
            $queryParams = ['should' => $queryClauses, 'boost' => $boost];

            if ($spellingType == SpellcheckerInterface::SPELLING_TYPE_MOST_FUZZY) {
                $queryParams['must'] = [$this->getWeightedSearchQuery($containerConfig, $queryText)];
            }

            $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, $queryParams);
        }

        return $query;
    }
private function getSpellcheckedQuery ( ContainerConfigurationInterface $ containerConfig , $ queryText , $ spellingType , $ boost ) { $ query = null ; $ relevanceConfig = $ containerConfig -> getRelevanceConfig ( ) ; $ queryClauses = [ ] ; if ( $ relevanceConfig -> isFuzzinessEnabled ( ) ) { $ queryClauses [ ] = $ this -> getFuzzyQuery ( $ containerConfig , $ queryText ) ; } if ( $ relevanceConfig -> isPhoneticSearchEnabled ( ) ) { $ queryClauses [ ] = $ this -> getPhoneticQuery ( $ containerConfig , $ queryText ) ; } if ( ! empty ( $ queryClauses ) ) { $ queryParams = [ 'should' => $ queryClauses , 'boost' => $ boost ] ; if ( $ spellingType == SpellcheckerInterface :: SPELLING_TYPE_MOST_FUZZY ) { $ queryParams [ 'must' ] = [ $ this -> getWeightedSearchQuery ( $ containerConfig , $ queryText ) ] ; } $ query = $ this -> queryFactory -> create ( QueryInterface :: TYPE_BOOL , $ queryParams ) ; } return $ query ; }
Spellcheked query building.

@param ContainerConfigurationInterface $containerConfig Search request container configuration.
@param string                          $queryText       The text query.
@param string                          $spellingType    The type of spellchecked applied.
@param float                           $boost           Boost of the created query.

@return QueryInterface
Spellcheked query building .