-
Notifications
You must be signed in to change notification settings - Fork 6
DOCSP-49758: Atlas search indexes #29
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,9 +202,41 @@ Advanced Index Configuration | |
This section shows how to create the following advanced | ||
index types: | ||
|
||
- :ref:`django-indexes-atlas-search` | ||
- :ref:`django-indexes-partial` | ||
- :ref:`django-indexes-unique` | ||
|
||
.. _django-indexes-atlas-search: | ||
|
||
Atlas Search Indexes | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Atlas Search indexes specify the behavior of an Atlas Search, or a full-text | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit naive on this functionaltiy, but I'm not sure what "or" means here. Does it mean "in other words"? https://www.mongodb.com/docs/atlas/atlas-search/ says "Atlas Search is an embedded full-text search" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, "in other words." I changed to "which is" for clarity |
||
search on collections hosted on MongoDB Atlas. | ||
|
||
To create an Atlas Search index, assign the ``indexes`` option in your model's | ||
``Meta`` class to a ``SearchIndex`` object. Pass the following arguments to the | ||
``SearchIndex()`` constructor: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be great to add interphinx support for django_mongodb_backend, e.g.
(could be done separately) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a link to the SearchIndex class to the tip at the end of this section |
||
|
||
- ``fields``: The fields you want to index. | ||
- ``name``: *(Optional)* The name of your Atlas Search index. If you do not | ||
specify this argument, {+django-odm+} automatically generates an index name. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's actually the behavior of Django to automatically generate an index name rather than Django Mongo Backend. |
||
|
||
The following example updates the ``Recipe`` model's ``Meta`` class to create | ||
an Atlas Search index named ``"title_search_idx"`` on the ``title`` field: | ||
|
||
.. literalinclude:: /includes/model-data/indexes.py | ||
:start-after: start-atlas-search | ||
:end-before: end-atlas-search | ||
:language: python | ||
:copyable: | ||
:emphasize-lines: 3-6 | ||
|
||
.. tip:: | ||
|
||
To learn more about Atlas Search queries and indexes, see :atlas:`Atlas Search </atlas-search>` | ||
in the Atlas documentation. | ||
|
||
.. _django-indexes-partial: | ||
|
||
Partial Indexes | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the indent style that Django uses: