Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Spellchecker::loadSpellingType PHP Method

loadSpellingType() private method

Compute the spelling time using the engine.
private loadSpellingType ( Smile\ElasticsuiteCore\Api\Search\Spellchecker\RequestInterface $request ) : integer
$request Smile\ElasticsuiteCore\Api\Search\Spellchecker\RequestInterface Spellchecking request.
return integer
    private function loadSpellingType(RequestInterface $request)
    {
        $cutoffFrequencyLimit = $this->getCutoffrequencyLimit($request);
        $termVectors = $this->getTermVectors($request);
        $queryTermStats = $this->parseTermVectors($termVectors, $cutoffFrequencyLimit);
        $spellingType = self::SPELLING_TYPE_FUZZY;
        if ($queryTermStats['total'] == $queryTermStats['stop']) {
            $spellingType = self::SPELLING_TYPE_PURE_STOPWORDS;
        } elseif ($queryTermStats['total'] == $queryTermStats['stop'] + $queryTermStats['exact']) {
            $spellingType = self::SPELLING_TYPE_EXACT;
        } elseif ($queryTermStats['missing'] == 0) {
            $spellingType = self::SPELLING_TYPE_MOST_EXACT;
        } elseif ($queryTermStats['total'] - $queryTermStats['missing'] > 0) {
            $spellingType = self::SPELLING_TYPE_MOST_FUZZY;
        }
        return $spellingType;
    }