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;
    }
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;
    }
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 ; }
Perform fulltext search

@link https://docs.mongodb.org/manual/reference/operator/query/text/
@link https://docs.mongodb.org/manual/tutorial/specify-language-for-text-index/

If a collection contains documents or embedded documents that are in different languages,
include a field named language in the documents or embedded documents and specify as its value the language
for that document or embedded document.

The specified language in the document overrides the default language for the text index.
The specified language in an embedded document override the language specified in an enclosing document or
the default language for the index.

Case Insensitivity:
@link https://docs.mongodb.org/manual/reference/operator/query/text/#text-operator-case-sensitivity

Diacritic Insensitivity:
@link https://docs.mongodb.org/manual/reference/operator/query/text/#text-operator-diacritic-sensitivity

@param $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.
@param $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.
@param bool|false $caseSensitive 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.
@param bool|false $diacriticSensitive 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.
@return $this
Perform fulltext search