Skip to content

Commit 0aa805e

Browse files
Fix method names in full text query documentation.
Closes #3525
1 parent 9dc1df3 commit 0aa805e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/asciidoc/reference/mongodb.adoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ A query searching for `coffee cake` can be defined and run as follows:
17311731
[source,java]
17321732
----
17331733
Query query = TextQuery
1734-
.searching(new TextCriteria().matchingAny("coffee", "cake"));
1734+
.queryText(new TextCriteria().matchingAny("coffee", "cake"));
17351735
17361736
List<Document> page = template.find(query, Document.class);
17371737
----
@@ -1744,7 +1744,7 @@ To sort results by relevance according to the `weights` use `TextQuery.sortBySco
17441744
[source,java]
17451745
----
17461746
Query query = TextQuery
1747-
.searching(new TextCriteria().matchingAny("coffee", "cake"))
1747+
.queryText(new TextCriteria().matchingAny("coffee", "cake"))
17481748
.sortByScore() <1>
17491749
.includeScore(); <2>
17501750
@@ -1759,17 +1759,17 @@ You can exclude search terms by prefixing the term with `-` or by using `notMatc
17591759
[source,java]
17601760
----
17611761
// search for 'coffee' and not 'cake'
1762-
TextQuery.searching(new TextCriteria().matching("coffee").matching("-cake"));
1763-
TextQuery.searching(new TextCriteria().matching("coffee").notMatching("cake"));
1762+
TextQuery.queryText(new TextCriteria().matching("coffee").matching("-cake"));
1763+
TextQuery.queryText(new TextCriteria().matching("coffee").notMatching("cake"));
17641764
----
17651765

17661766
`TextCriteria.matching` takes the provided term as is. Therefore, you can define phrases by putting them between double quotation marks (for example, `\"coffee cake\")` or using by `TextCriteria.phrase.` The following example shows both ways of defining a phrase:
17671767

17681768
[source,java]
17691769
----
17701770
// search for phrase 'coffee cake'
1771-
TextQuery.searching(new TextCriteria().matching("\"coffee cake\""));
1772-
TextQuery.searching(new TextCriteria().phrase("coffee cake"));
1771+
TextQuery.queryText(new TextCriteria().matching("\"coffee cake\""));
1772+
TextQuery.queryText(new TextCriteria().phrase("coffee cake"));
17731773
----
17741774

17751775
You can set flags for `$caseSensitive` and `$diacriticSensitive` by using the corresponding methods on `TextCriteria`. Note that these two optional flags have been introduced in MongoDB 3.2 and are not included in the query unless explicitly set.

0 commit comments

Comments
 (0)