Sokil\Mongo\Expression::whereText PHP Метод

whereText() публичный Метод

Perform fulltext search
public whereText ( $search, $language = null, boolean | false $caseSensitive = null, boolean | false $diacriticSensitive = null )
$search A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase.
$language Optional. The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. If you specify a language value of "none", then the text search uses simple tokenization with no list of stop words and no stemming.
$caseSensitive boolean | false Allowed from v.3.2 A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index.
$diacriticSensitive boolean | false Allowed from v.3.2 A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index.
    public function whereText($search, $language = null, $caseSensitive = null, $diacriticSensitive = null)
    {
        $this->_expression['$text'] = array('$search' => $search);
        if ($language) {
            $this->_expression['$text']['$language'] = $language;
        }
        // Version 3.2 feature
        if ($caseSensitive) {
            $this->_expression['$text']['$caseSensitive'] = (bool) $caseSensitive;
        }
        // Version 3.2 feature
        if ($diacriticSensitive) {
            $this->_expression['$text']['$diacriticSensitive'] = (bool) $diacriticSensitive;
        }
        return $this;
    }