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;
    }