Skip to content

Commit 9c17ee0

Browse files
Fix method names in full text query documentation.
Closes #3525
1 parent be84b18 commit 9c17ee0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/asciidoc/reference/mongodb.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ A query searching for `coffee cake`, sorted by relevance according to the `weigh
16651665

16661666
[source,java]
16671667
----
1668-
Query query = TextQuery.searching(new TextCriteria().matchingAny("coffee", "cake")).sortByScore();
1668+
Query query = TextQuery.queryText(new TextCriteria().matchingAny("coffee", "cake")).sortByScore();
16691669
List<Document> page = template.find(query, Document.class);
16701670
----
16711671

@@ -1674,17 +1674,17 @@ You can exclude search terms by prefixing the term with `-` or by using `notMatc
16741674
[source,java]
16751675
----
16761676
// search for 'coffee' and not 'cake'
1677-
TextQuery.searching(new TextCriteria().matching("coffee").matching("-cake"));
1678-
TextQuery.searching(new TextCriteria().matching("coffee").notMatching("cake"));
1677+
TextQuery.queryText(new TextCriteria().matching("coffee").matching("-cake"));
1678+
TextQuery.queryText(new TextCriteria().matching("coffee").notMatching("cake"));
16791679
----
16801680

16811681
`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:
16821682

16831683
[source,java]
16841684
----
16851685
// search for phrase 'coffee cake'
1686-
TextQuery.searching(new TextCriteria().matching("\"coffee cake\""));
1687-
TextQuery.searching(new TextCriteria().phrase("coffee cake"));
1686+
TextQuery.queryText(new TextCriteria().matching("\"coffee cake\""));
1687+
TextQuery.queryText(new TextCriteria().phrase("coffee cake"));
16881688
----
16891689

16901690
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)