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

getWordIdSubquery() protected method

Get subquery to select relevant word IDs.
protected getWordIdSubquery ( eZ\Publish\Core\Persistence\Database\SelectQuery $query, string $string ) : eZ\Publish\Core\Persistence\Database\SelectQuery
$query eZ\Publish\Core\Persistence\Database\SelectQuery
$string string
return eZ\Publish\Core\Persistence\Database\SelectQuery
    protected function getWordIdSubquery(SelectQuery $query, $string)
    {
        $subQuery = $query->subSelect();
        $tokens = $this->tokenizeString($this->processor->transform($string, $this->configuration['commands']));
        $wordExpressions = array();
        foreach ($tokens as $token) {
            $wordExpressions[] = $this->getWordExpression($subQuery, $token);
        }
        $whereCondition = $subQuery->expr->lOr($wordExpressions);
        // If stop word threshold is below 100%, make it part of $whereCondition
        if ($this->configuration['stopWordThresholdFactor'] < 1) {
            $whereCondition = $subQuery->expr->lAnd($whereCondition, $subQuery->expr->lt($this->dbHandler->quoteColumn('object_count'), $subQuery->bindValue($this->getStopWordThresholdValue())));
        }
        $subQuery->select($this->dbHandler->quoteColumn('id'))->from($this->dbHandler->quoteTable('ezsearch_word'))->where($whereCondition);
        return $subQuery;
    }