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;
    }
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;
    }
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 ; }
Get subquery to select relevant word IDs.

@uses ::getStopWordThresholdValue() To get threshold for words we would like to ignore in query.

@param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
@param string $string

@return \eZ\Publish\Core\Persistence\Database\SelectQuery
Get subquery to select relevant word IDs .