Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

norareidy
Copy link
Collaborator

@norareidy norareidy commented May 5, 2025

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-49758

Staging Links

  • limitations-upcoming
  • model-data/indexes
  • Self-Review Checklist

    • Is this free of any warnings or errors in the RST?
    • Did you run a spell-check?
    • Did you run a grammar-check?
    • Are all the links working?
    • Are the facets and meta keywords accurate?

    Copy link

    netlify bot commented May 5, 2025

    Deploy Preview for docs-django ready!

    Name Link
    🔨 Latest commit ffae44b
    🔍 Latest deploy log https://app.netlify.com/sites/docs-django/deploys/681e1acec6f2cb000806045c
    😎 Deploy Preview https://deploy-preview-29--docs-django.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    class Meta:
    db_table = "recipes"
    indexes = [
    SearchIndex(fields=["title"],
    Copy link
    Collaborator

    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:

    SearchIndex(
        fields=["title"],
        name="title_search_idx",
    )
    


    - ``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.
    Copy link
    Collaborator

    Choose a reason for hiding this comment

    The 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.


    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:
    Copy link
    Collaborator

    Choose a reason for hiding this comment

    The 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.

    :class:`~django_mongodb_backend.indexes.SearchIndex`
    

    (could be done separately)

    Copy link
    Collaborator Author

    Choose a reason for hiding this comment

    The 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

    Atlas Search Indexes
    ~~~~~~~~~~~~~~~~~~~~

    Atlas Search indexes specify the behavior of an Atlas Search, or a full-text
    Copy link
    Collaborator

    Choose a reason for hiding this comment

    The 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"

    Copy link
    Collaborator Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Yes, "in other words." I changed to "which is" for clarity

    @timgraham
    Copy link
    Collaborator

    Also, this feature will only be in Django MongoDB Backend 5.2.x for Django 5.2.x, so a prerequisite to this documentation is to create the branch for 5.1.x and update the master branch to 5.2.x.

    @norareidy norareidy marked this pull request as ready for review May 9, 2025 15:04
    Copy link

    @rachel-mack rachel-mack left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    lgtm

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants