@@ -10,109 +10,54 @@ Text Search
1010 :depth: 1
1111 :class: singlecol
1212
13- Overview
14- --------
13+ MongoDB provides different text search capabilities depending on whether
14+ your data is hosted on :atlas:`MongoDB Atlas </>` or a self-managed
15+ deployment.
1516
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.
17+ MongoDB Atlas Search
18+ --------------------
1919
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
20+ To perform text search on data hosted on MongoDB Atlas, use
21+ :atlas:`MongoDB Atlas Search </atlas-search>`. Atlas Search supports
22+ fine-grained text indexing and a rich query language for fast, relevant
23+ search results.
5524
56- Exact Phrase
57- ````````````
25+ To learn more and get started with Atlas Search, see:
5826
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.
27+ - :atlas:`Atlas Search Aggregation Pipeline Stages
28+ </reference/atlas-search/query-syntax/>`
29+ - :atlas:`Defining Atlas Search Indexes
30+ </reference/atlas-search/index-definitions/>`
31+ - :atlas:`Running Atlas Search Queries
32+ </reference/atlas-search/searching/>`
6233
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.
34+ .. include:: /includes/fact-atlas-search-languages.rst
8935
90- To sort the results in order of relevance score, you must explicitly
91- project the :expression:`$meta` ``textScore`` field and sort on it:
36+ Text Search on Self-Managed Deployments
37+ ---------------------------------------
9238
93- .. code-block:: javascript
39+ For self-managed (non-Atlas) deployments, MongoDB's text search
40+ capability supports query operations that perform a text search of
41+ string content. To perform text search, MongoDB uses a :ref:`text index
42+ <index-feature-text>` and the :query:`$text` operator.
9443
95- db.stores.find(
96- { $text: { $search: "java coffee shop" } },
97- { score: { $meta: "textScore" } }
98- ).sort( { score: { $meta: "textScore" } } )
44+ .. note::
9945
100- Text search is also available in the aggregation pipeline.
46+ .. include:: /includes/extracts/views-unsupported-text-search.rst
10147
102- Language Support
103- ----------------
48+ To learn more about text search for self-managed deployments, see:
49+
50+ - :doc:`Text Indexes </core/link-text-indexes/>`
51+ - :doc:`Text Search Operators </core/text-search-operators/>`
10452
105- MongoDB supports text search for various languages. See
106- :doc:`/reference/text-search-languages` for a list of supported
107- languages.
53+ MongoDB also supports text search for various languages. For a list of
54+ supported languages, see :ref:`text-search-languages`.
10855
10956.. include:: /includes/fact-atlas-search-languages.rst
11057
11158.. toctree::
11259 :titlesonly:
11360 :hidden:
114-
115- /core/link-text-indexes
116- /core/text-search-operators
117- /tutorial/text-search-in-aggregation
118- /reference/text-search-languages
61+
62+ MongoDB Atlas Search <https://www.mongodb.com/docs/atlas/atlas-search/>
63+ /core/text-search/on-prem
0 commit comments