public function create(ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost = 1)
    {
        $query = null;

        $fuzzySpellingTypes = [SpellcheckerInterface::SPELLING_TYPE_FUZZY, SpellcheckerInterface::SPELLING_TYPE_MOST_FUZZY];

        if (is_array($queryText)) {
            $queries = [];
            foreach ($queryText as $currentQueryText) {
                $queries[] = $this->create($containerConfig, $currentQueryText, $spellingType);
            }
            $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, ['should' => $queries, 'boost' => $boost]);
        } elseif ($spellingType == SpellcheckerInterface::SPELLING_TYPE_PURE_STOPWORDS) {
            $query = $this->getPureStopwordsQuery($containerConfig, $queryText, $boost);
        } elseif (in_array($spellingType, $fuzzySpellingTypes)) {
            $query = $this->getSpellcheckedQuery($containerConfig, $queryText, $spellingType, $boost);
        }

        if ($query === null) {
            $queryParams = [
                'query'  => $this->getWeightedSearchQuery($containerConfig, $queryText),
                'filter' => $this->getCutoffFrequencyQuery($containerConfig, $queryText),
                'boost'  => $boost,
            ];
            $query = $this->queryFactory->create(QueryInterface::TYPE_FILTER, $queryParams);
        }

        return $query;
    }
public function create(ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost = 1)
    {
        $query = null;

        $fuzzySpellingTypes = [SpellcheckerInterface::SPELLING_TYPE_FUZZY, SpellcheckerInterface::SPELLING_TYPE_MOST_FUZZY];

        if (is_array($queryText)) {
            $queries = [];
            foreach ($queryText as $currentQueryText) {
                $queries[] = $this->create($containerConfig, $currentQueryText, $spellingType);
            }
            $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, ['should' => $queries, 'boost' => $boost]);
        } elseif ($spellingType == SpellcheckerInterface::SPELLING_TYPE_PURE_STOPWORDS) {
            $query = $this->getPureStopwordsQuery($containerConfig, $queryText, $boost);
        } elseif (in_array($spellingType, $fuzzySpellingTypes)) {
            $query = $this->getSpellcheckedQuery($containerConfig, $queryText, $spellingType, $boost);
        }

        if ($query === null) {
            $queryParams = [
                'query'  => $this->getWeightedSearchQuery($containerConfig, $queryText),
                'filter' => $this->getCutoffFrequencyQuery($containerConfig, $queryText),
                'boost'  => $boost,
            ];
            $query = $this->queryFactory->create(QueryInterface::TYPE_FILTER, $queryParams);
        }

        return $query;
    }
public function create ( ContainerConfigurationInterface $ containerConfig , $ queryText , $ spellingType , $ boost = 1 ) { $ query = null ; $ fuzzySpellingTypes = [ SpellcheckerInterface :: SPELLING_TYPE_FUZZY , SpellcheckerInterface :: SPELLING_TYPE_MOST_FUZZY ] ; if ( is_array ( $ queryText ) ) { $ queries = [ ] ; foreach ( $ queryText as $ currentQueryText ) { $ queries [ ] = $ this -> create ( $ containerConfig , $ currentQueryText , $ spellingType ) ; } $ query = $ this -> queryFactory -> create ( QueryInterface :: TYPE_BOOL , [ 'should' => $ queries , 'boost' => $ boost ] ) ; } elseif ( $ spellingType == SpellcheckerInterface :: SPELLING_TYPE_PURE_STOPWORDS ) { $ query = $ this -> getPureStopwordsQuery ( $ containerConfig , $ queryText , $ boost ) ; } elseif ( in_array ( $ spellingType , $ fuzzySpellingTypes ) ) { $ query = $ this -> getSpellcheckedQuery ( $ containerConfig , $ queryText , $ spellingType , $ boost ) ; } if ( $ query === null ) { $ queryParams = [ 'query' => $ this -> getWeightedSearchQuery ( $ containerConfig , $ queryText ) , 'filter' => $ this -> getCutoffFrequencyQuery ( $ containerConfig , $ queryText ) , 'boost' => $ boost , ] ; $ query = $ this -> queryFactory -> create ( QueryInterface :: TYPE_FILTER , $ queryParams ) ; } return $ query ; }
Create the fulltext search query.

@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
Create the fulltext search query .