-
Notifications
You must be signed in to change notification settings - Fork 34
DOCSP-41987: atlas search idx #143
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
rustagir
merged 4 commits into
mongodb:php-standardization
from
rustagir:DOCSP-41987-atlas-search-dx
Sep 18, 2024
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
.. _php-atlas-search-index: | ||
|
||
==================== | ||
Atlas Search Indexes | ||
==================== | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: reference | ||
|
||
.. meta:: | ||
:keywords: index, query, text search, efficiency | ||
|
||
Overview | ||
-------- | ||
|
||
The MongoDB Atlas Search feature enables you to perform full-text | ||
searches on collections hosted on Atlas. The indexes specify the | ||
behavior which fields to index and how they are indexed. | ||
|
||
To learn more about Atlas Search, see the :atlas:`Atlas Search Overview | ||
</atlas-search/atlas-search-overview/>`. | ||
|
||
You can use the following methods on a ``MongoDB\Collection`` instance | ||
to manage your Atlas Search indexes: | ||
|
||
- ``MongoDB\Collection::createSearchIndex()`` | ||
- ``MongoDB\Collection::createSearchIndexes()`` | ||
- ``MongoDB\Collection::listSearchIndexes()`` | ||
- ``MongoDB\Collection::updateSearchIndex()`` | ||
- ``MongoDB\Collection::dropSearchIndex()`` | ||
|
||
.. note:: Atlas Search Index Management is Asynchronous | ||
|
||
The {+php-library+} manages Atlas Search indexes asynchronously. The | ||
library methods described in the following sections return the server | ||
response immediately, but the changes to your Search indexes take | ||
place in the background and might not complete until some time later. | ||
|
||
The following sections provide code examples that demonstrate how to use | ||
each Atlas Search index management method. | ||
|
||
.. _php-atlas-search-index-create: | ||
|
||
Create a Search Index | ||
--------------------- | ||
|
||
You can use the ``createSearchIndex()`` method to create a single Atlas | ||
Search index on a collection, or the ``createSearchIndexes()`` method to | ||
create multiple indexes simultaneously. | ||
|
||
The following code example shows how to create a single Atlas Search | ||
index: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.php | ||
:language: php | ||
:start-after: start-create-search-index | ||
:end-before: end-create-search-index | ||
|
||
The following code example shows how to create multiple Atlas Search | ||
indexes: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.php | ||
:language: php | ||
:start-after: start-create-search-indexes | ||
:end-before: end-create-search-indexes | ||
|
||
After you create a Search index, you can perform Atlas Search queries on | ||
your collection. To learn more, see :atlas:`Create and Run Atlas Search | ||
Queries </atlas-search/searching/>` in the Atlas documentation. | ||
|
||
.. _php-atlas-search-index-list: | ||
|
||
List Search Indexes | ||
------------------- | ||
|
||
You can use the ``listSearchIndexes()`` method to return an array of the | ||
Atlas Search indexes on a collection: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.php | ||
:language: php | ||
:dedent: | ||
:start-after: start-list-search-indexes | ||
:end-before: end-list-search-indexes | ||
|
||
.. _php-atlas-search-index-update: | ||
|
||
Update a Search Index | ||
--------------------- | ||
|
||
You can use the ``updateSearchIndex()`` | ||
method to update an Atlas Search index. You can use this method to | ||
change the name of a Search index or change the configuration of the | ||
index. | ||
|
||
The following code shows how to update a search index to use a simple | ||
analyzer on the ``title`` field: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.php | ||
:language: php | ||
:dedent: | ||
:start-after: start-update-search-indexes | ||
:end-before: end-update-search-indexes | ||
|
||
.. _php-atlas-search-index-drop: | ||
|
||
Delete a Search Index | ||
--------------------- | ||
|
||
You can use the ``dropSearchIndex()`` method to remove an Atlas Search | ||
index from a collection. | ||
|
||
The following code shows how to delete the Atlas Search index named | ||
``mySearchIdx``: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.php | ||
:language: php | ||
:dedent: | ||
:start-after: start-delete-search-index | ||
:end-before: end-delete-search-index | ||
|
||
Additional Information | ||
---------------------- | ||
|
||
To view runnable examples that demonstrate how to manage indexes, see | ||
:ref:`php-indexes`. | ||
|
||
To view tutorials that explain how to use the Atlas Search feature, see | ||
:atlas:`Get Started with Atlas Search </atlas-search/tutorial/>` in the | ||
Atlas documentation. | ||
|
||
API Documentation | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
To learn more about any of the methods discussed in this guide, see the | ||
following API documentation: | ||
|
||
- :phpmethod:`MongoDB\Collection::createSearchIndex()` | ||
- :phpmethod:`MongoDB\Collection::createSearchIndexes()` | ||
- :phpmethod:`MongoDB\Collection::listSearchIndexes()` | ||
- :phpmethod:`MongoDB\Collection::updateSearchIndex()` | ||
- :phpmethod:`MongoDB\Collection::dropSearchIndex()` |
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
Oops, something went wrong.
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.