-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DOCSP-17260 Direct Text Search traffic to Atlas Search #5946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jason-price-mongodb
merged 6 commits into
mongodb:master
from
kanchana-mongodb:DOCSP-17260
Oct 19, 2021
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dfa34c5
DOCSP-17260 Direct Text Search traffic to Atlas Search
kanchana-mongodb 17ecefa
DOCSP-17260 updates for copy review feedback
kanchana-mongodb e83daad
DOCSP-17260 2nd round of updates for copy review feedback
kanchana-mongodb 54c5f79
DOCSP-17260 updates for review feedback
kanchana-mongodb f788d4b
DOCSP-17260 added link to search and intro to two more pages
kanchana-mongodb 628ad20
DOCSP-17260 addressing Jenny's feedback comments
kanchana-mongodb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,89 @@ | ||
============ | ||
Text Indexes | ||
============ | ||
============================== | ||
Perform a Text Search (Legacy) | ||
============================== | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. include:: /includes/fact-text-index.rst | ||
|
||
.. include:: /includes/fact-create-text-index.rst | ||
.. include:: /includes/fact-text-search-legacy-atlas.rst | ||
|
||
.. include:: /includes/fact-text-index.rst | ||
|
||
See the :doc:`/core/index-text` section for a full reference on text | ||
indexes, including behavior, tokenization, and properties. | ||
|
||
.. _text-index-eg: | ||
|
||
Examples | ||
-------- | ||
|
||
This example demonstrates how to build a text index and use it to find | ||
coffee shops, given only text fields. | ||
|
||
Create a Collection | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
Create a collection ``stores`` with the following documents: | ||
|
||
.. code-block:: javascript | ||
|
||
db.stores.insertMany( | ||
[ | ||
{ _id: 1, name: "Java Hut", description: "Coffee and cakes" }, | ||
{ _id: 2, name: "Burger Buns", description: "Gourmet hamburgers" }, | ||
{ _id: 3, name: "Coffee Shop", description: "Just coffee" }, | ||
{ _id: 4, name: "Clothes Clothes Clothes", description: "Discount clothing" }, | ||
{ _id: 5, name: "Java Shopping", description: "Indonesian goods" } | ||
] | ||
) | ||
|
||
Create a Text Index | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. include:: /includes/fact-create-text-index.rst | ||
|
||
Search for an Exact Phrase | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
You can also search for exact phrases by wrapping them in double-quotes. | ||
If the ``$search`` string includes a phrase and individual terms, text | ||
search will only match documents that include the phrase. | ||
|
||
For example, the following will find all documents containing | ||
"coffee shop": | ||
|
||
.. code-block:: javascript | ||
|
||
db.stores.find( { $text: { $search: "\"coffee shop\"" } } ) | ||
|
||
For more information, see :ref:`text-operator-phrases`. | ||
|
||
Exclude a Term | ||
~~~~~~~~~~~~~~ | ||
|
||
To exclude a word, you can prepend a "``-``" character. For example, to | ||
find all stores containing "java" or "shop" but not "coffee", use the | ||
following: | ||
|
||
.. code-block:: javascript | ||
|
||
db.stores.find( { $text: { $search: "java shop -coffee" } } ) | ||
|
||
Sort the Results | ||
~~~~~~~~~~~~~~~~ | ||
|
||
MongoDB will return its results in unsorted order by default. However, | ||
text search queries will compute a relevance score for each document | ||
that specifies how well a document matches the query. | ||
|
||
To sort the results in order of relevance score, you must explicitly | ||
project the :expression:`$meta` ``textScore`` field and sort on it: | ||
|
||
.. code-block:: javascript | ||
|
||
db.stores.find( | ||
{ $text: { $search: "java coffee shop" } }, | ||
{ score: { $meta: "textScore" } } | ||
).sort( { score: { $meta: "textScore" } } ) | ||
|
||
Text search is also available in the aggregation pipeline. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
For data hosted on MongoDB Atlas, :atlas:`Atlas Search </atlas-search>` | ||
provides support for additional languages. To see the complete list of | ||
languages supported by Atlas Search, see the :atlas:`Atlas Search | ||
Language Analyzers </reference/atlas-search/analyzers/language/>`. | ||
:atlas:`Atlas Search </atlas-search>` also offers common | ||
:atlas:`analyzers for parsing text for full-text search | ||
</reference/atlas-search/analyzers/>`, including support for over | ||
:atlas:`40 language-specific analyzers | ||
</reference/atlas-search/analyzers/language/>`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
MongoDB provides :ref:`text indexes <index-feature-text>` to support | ||
text search queries on string content. ``text`` indexes can include any | ||
field whose value is a string or an array of string elements. | ||
To run legacy text search queries, you must have a ``text`` index on | ||
your collection. MongoDB provides :ref:`text indexes | ||
<index-feature-text>` to support text search queries on string content. | ||
``text`` indexes can include any field whose value is a string or an | ||
array of string elements. A collection can only have **one** text | ||
search index, but that index can cover multiple fields. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MongoDB offers a :atlas:`premium full-text search solution, MongoDB | ||
Atlas Search </atlas-search/>`, for data hosted on :atlas:`MongoDB | ||
Atlas </>`. A legacy text search capability is available for users | ||
self-managing MongoDB deployments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.