@@ -10,104 +10,47 @@ Text Search
1010 :depth: 1
1111 :class: singlecol
1212
13- Overview
14- --------
13+ .. include:: /includes/fact-text-search-legacy-atlas.rst
1514
16- MongoDB supports query operations that perform a text search of string
17- content. To perform text search, MongoDB uses a
18- :ref:`text index <index-feature-text>` and the :query:`$text` operator.
15+ MongoDB Atlas Search
16+ --------------------
1917
20- .. note::
21-
22- .. include:: /includes/extracts/views-unsupported-text-search.rst
23-
24- Example
25- -------
26-
27- This example demonstrates how to build a text index and use it to find
28- coffee shops, given only text fields.
29-
30- Create a collection ``stores`` with the following documents:
31-
32- .. code-block:: javascript
33-
34- db.stores.insert(
35- [
36- { _id: 1, name: "Java Hut", description: "Coffee and cakes" },
37- { _id: 2, name: "Burger Buns", description: "Gourmet hamburgers" },
38- { _id: 3, name: "Coffee Shop", description: "Just coffee" },
39- { _id: 4, name: "Clothes Clothes Clothes", description: "Discount clothing" },
40- { _id: 5, name: "Java Shopping", description: "Indonesian goods" }
41- ]
42- )
43-
44- Text Index
45- ~~~~~~~~~~
46-
47- .. include:: /includes/fact-text-index.rst
48-
49- .. include:: /includes/fact-create-text-index.rst
50-
51- ``$text`` Operator
52- ~~~~~~~~~~~~~~~~~~
53-
54- .. include:: /includes/fact-use-text-operator.rst
55-
56- Exact Phrase
57- ````````````
18+ For MongoDB Atlas users, MongoDB's Atlas Search supports fine-grained
19+ text indexing and a rich query language for fast, relevant search
20+ results. To learn more about full-text search indexes and
21+ :pipeline:`$search` queries, see:
5822
59- You can also search for exact phrases by wrapping them in double-quotes.
60- If the ``$search`` string includes a phrase and individual terms, text search
61- will only match documents that include the phrase.
23+ - :atlas:`Atlas Search Aggregation Pipeline Stages
24+ </reference/atlas-search/query-syntax/>`
25+ - :atlas:`Defining Atlas Search Indexes
26+ </reference/atlas-search/index-definitions/>`
27+ - :atlas:`Running Atlas Search Queries
28+ </reference/atlas-search/searching/>`
6229
63- For example, the following will find all documents containing
64- "coffee shop":
65-
66- .. code-block:: javascript
67-
68- db.stores.find( { $text: { $search: "\"coffee shop\"" } } )
69-
70- For more information, see :ref:`text-operator-phrases`.
71-
72- Term Exclusion
73- ``````````````
74-
75- To exclude a word, you can prepend a "``-``" character. For example, to
76- find all stores containing "java" or "shop" but not "coffee", use the
77- following:
78-
79- .. code-block:: javascript
80-
81- db.stores.find( { $text: { $search: "java shop -coffee" } } )
82-
83- Sorting
84- ```````
85-
86- MongoDB will return its results in unsorted order by default. However,
87- text search queries will compute a relevance score for each document
88- that specifies how well a document matches the query.
30+ .. include:: /includes/fact-atlas-search-languages.rst
8931
90- To sort the results in order of relevance score, you must explicitly
91- project the :expression:`$meta` ``textScore`` field and sort on it:
32+ Legacy Text Search
33+ ------------------
9234
93- .. code-block:: javascript
35+ For self-managed deployments, MongoDB's legacy text search capability
36+ supports query operations that perform a text search of string content.
37+ To perform text search, MongoDB uses a :ref:`text index
38+ <index-feature-text>` and the :query:`$text` operator.
9439
95- db.stores.find(
96- { $text: { $search: "java coffee shop" } },
97- { score: { $meta: "textScore" } }
98- ).sort( { score: { $meta: "textScore" } } )
40+ .. note::
9941
100- Text search is also available in the aggregation pipeline.
42+ .. include:: /includes/extracts/views-unsupported-text-search.rst
10143
102- Language Support
103- ----------------
44+ To learn more about legacy text search for self-managed deployments,
45+ see:
46+
47+ - :doc:`Text Indexes </core/link-text-indexes/>`
48+ - :doc:`Text Search Operators </core-text-search-operators/>`
10449
105- MongoDB supports text search for various languages. See
50+ MongoDB also supports text search for various languages. See
10651:doc:`/reference/text-search-languages` for a list of supported
10752languages.
10853
109- .. include:: /includes/fact-atlas-search-languages.rst
110-
11154.. toctree::
11255 :titlesonly:
11356 :hidden:
0 commit comments