eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FullText::getStopWordThresholdValue PHP Method

getStopWordThresholdValue() protected method

Common terms will be skipped if used in more then a given percentage of the total amount of content objects in the database. Percentage is defined by stopWordThresholdFactor configuration. Example: If stopWordThresholdFactor is 0.66 (66%), and a term like "the" exists in more then 66% of the content, it will ignore the phrase as it is assumed to not add any value ot the search. Caches the result for the instance used as we don't need this to be super accurate as it is based on percentage, set by stopWordThresholdFactor.
protected getStopWordThresholdValue ( ) : integer
return integer
    protected function getStopWordThresholdValue()
    {
        if ($this->stopWordThresholdValue !== null) {
            return $this->stopWordThresholdValue;
        }
        // Cached value does not exists, do a simple count query on ezcontentobject table
        $query = $this->dbHandler->createSelectQuery();
        $query->select($query->alias($query->expr->count('*'), 'count'))->from($this->dbHandler->quoteTable('ezcontentobject'));
        $statement = $query->prepare();
        $statement->execute();
        // Calculate the int stopWordThresholdValue based on count (first column) * factor
        return $this->stopWordThresholdValue = (int) ($statement->fetchColumn() * $this->configuration['stopWordThresholdFactor']);
    }