Skip to content

Commit ede2f5e

Browse files
Fix method names in full text query documentation.
Closes #3525
1 parent 49feb3d commit ede2f5e

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
@@ -1436,7 +1436,7 @@ A query searching for `coffee cake`, sorted by relevance according to the `weigh
14361436

14371437
[source,java]
14381438
----
1439-
Query query = TextQuery.searching(new TextCriteria().matchingAny("coffee", "cake")).sortByScore();
1439+
Query query = TextQuery.queryText(new TextCriteria().matchingAny("coffee", "cake")).sortByScore();
14401440
List<Document> page = template.find(query, Document.class);
14411441
----
14421442

@@ -1445,17 +1445,17 @@ You can exclude search terms by prefixing the term with `-` or by using `notMatc
14451445
[source,java]
14461446
----
14471447
// search for 'coffee' and not 'cake'
1448-
TextQuery.searching(new TextCriteria().matching("coffee").matching("-cake"));
1449-
TextQuery.searching(new TextCriteria().matching("coffee").notMatching("cake"));
1448+
TextQuery.queryText(new TextCriteria().matching("coffee").matching("-cake"));
1449+
TextQuery.queryText(new TextCriteria().matching("coffee").notMatching("cake"));
14501450
----
14511451

14521452
`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:
14531453

14541454
[source,java]
14551455
----
14561456
// search for phrase 'coffee cake'
1457-
TextQuery.searching(new TextCriteria().matching("\"coffee cake\""));
1458-
TextQuery.searching(new TextCriteria().phrase("coffee cake"));
1457+
TextQuery.queryText(new TextCriteria().matching("\"coffee cake\""));
1458+
TextQuery.queryText(new TextCriteria().phrase("coffee cake"));
14591459
----
14601460

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