From ede2f5eedaffb3f5fc2b0fb1ea872128ca569e1d Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 20 Jan 2021 08:29:26 +0100 Subject: [PATCH] Fix method names in full text query documentation. Closes #3525 --- src/main/asciidoc/reference/mongodb.adoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/asciidoc/reference/mongodb.adoc b/src/main/asciidoc/reference/mongodb.adoc index 66521c8e0..06613a332 100644 --- a/src/main/asciidoc/reference/mongodb.adoc +++ b/src/main/asciidoc/reference/mongodb.adoc @@ -1436,7 +1436,7 @@ A query searching for `coffee cake`, sorted by relevance according to the `weigh [source,java] ---- -Query query = TextQuery.searching(new TextCriteria().matchingAny("coffee", "cake")).sortByScore(); +Query query = TextQuery.queryText(new TextCriteria().matchingAny("coffee", "cake")).sortByScore(); List page = template.find(query, Document.class); ---- @@ -1445,8 +1445,8 @@ You can exclude search terms by prefixing the term with `-` or by using `notMatc [source,java] ---- // search for 'coffee' and not 'cake' -TextQuery.searching(new TextCriteria().matching("coffee").matching("-cake")); -TextQuery.searching(new TextCriteria().matching("coffee").notMatching("cake")); +TextQuery.queryText(new TextCriteria().matching("coffee").matching("-cake")); +TextQuery.queryText(new TextCriteria().matching("coffee").notMatching("cake")); ---- `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: @@ -1454,8 +1454,8 @@ TextQuery.searching(new TextCriteria().matching("coffee").notMatching("cake")); [source,java] ---- // search for phrase 'coffee cake' -TextQuery.searching(new TextCriteria().matching("\"coffee cake\"")); -TextQuery.searching(new TextCriteria().phrase("coffee cake")); +TextQuery.queryText(new TextCriteria().matching("\"coffee cake\"")); +TextQuery.queryText(new TextCriteria().phrase("coffee cake")); ---- 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.