driver-legacy/src/main/com/mongodb/QueryBuilder.java
public QueryBuilder text(final String search, @Nullable final String language) {
        if (_currentKey != null) {
            throw new QueryBuilderException("The text operand may only occur at the top-level of a query. It does"
                                            + " not apply to a specific element, but rather to a document as a whole.");
        }

        put(QueryOperators.TEXT);
        addOperand(QueryOperators.SEARCH, search);
        if (language != null) {
            addOperand(QueryOperators.LANGUAGE, language);
        }

        return this;
    }
public QueryBuilder text(final String search, @Nullable final String language) {
        if (_currentKey != null) {
            throw new QueryBuilderException("The text operand may only occur at the top-level of a query. It does"
                                            + " not apply to a specific element, but rather to a document as a whole.");
        }

        put(QueryOperators.TEXT);
        addOperand(QueryOperators.SEARCH, search);
        if (language != null) {
            addOperand(QueryOperators.LANGUAGE, language);
        }

        return this;
    }
Equivalent to a $text operand.

@param search   the search terms to apply to the text index.
@param language the language to use.
@return {@code this}
@mongodb.server.release 2.6