-
Notifications
You must be signed in to change notification settings - Fork 29
DOCSP-48887: docs+ atlas search tutorial #129
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
Changes from 4 commits
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 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,331 @@ | ||||||||||||||||
.. _mongoid-atlas-search-rails-tutorial: | ||||||||||||||||
|
||||||||||||||||
========================================================= | ||||||||||||||||
Tutorial: Integrate Atlas Search into a {+ror+} App | ||||||||||||||||
========================================================= | ||||||||||||||||
|
||||||||||||||||
.. facet:: | ||||||||||||||||
:name: genre | ||||||||||||||||
:values: reference | ||||||||||||||||
|
||||||||||||||||
.. meta:: | ||||||||||||||||
:keywords: code example, transform, pipeline | ||||||||||||||||
|
||||||||||||||||
.. contents:: On this page | ||||||||||||||||
:local: | ||||||||||||||||
:backlinks: none | ||||||||||||||||
:depth: 2 | ||||||||||||||||
:class: singlecol | ||||||||||||||||
|
||||||||||||||||
Overview | ||||||||||||||||
-------- | ||||||||||||||||
|
||||||||||||||||
In this tutorial, you can learn how to integrate :atlas:`Atlas Search | ||||||||||||||||
</atlas-search/>`, an advanced text search feature, into a {+ror+} app. | ||||||||||||||||
|
||||||||||||||||
After you complete this tutorial, you have a fully functional search | ||||||||||||||||
feature embedded in your Rails app, allowing you to efficiently find | ||||||||||||||||
information. | ||||||||||||||||
|
||||||||||||||||
Prerequisites | ||||||||||||||||
------------- | ||||||||||||||||
|
||||||||||||||||
The tutorial builds on a template app that you can download from the | ||||||||||||||||
:github:`mongodb-atlas-with-ruby-on-rails-example GitHub repository | ||||||||||||||||
<mongodb-developer/mongodb-atlas-with-ruby-on-rails-example>` by running | ||||||||||||||||
the following command: | ||||||||||||||||
|
||||||||||||||||
.. code-block:: bash | ||||||||||||||||
|
||||||||||||||||
git clone https://github.com/mongodb-developer/mongodb-atlas-with-ruby-on-rails-example.git | ||||||||||||||||
|
||||||||||||||||
Then, set up the following components: | ||||||||||||||||
|
||||||||||||||||
1. Create a MongoDB Atlas cluster. To learn how to create a cluster, see | ||||||||||||||||
the :ref:`mongoid-quick-start-rails-create-deployment` step of the | ||||||||||||||||
Rails Quick Start guide. | ||||||||||||||||
|
||||||||||||||||
#. Update the app's ``config/mongoid.yml`` file with your own connection | ||||||||||||||||
string and set the default database to ``inspiration``, as shown the | ||||||||||||||||
following example configuration: | ||||||||||||||||
|
||||||||||||||||
.. code-block:: yml | ||||||||||||||||
|
||||||||||||||||
development: | ||||||||||||||||
clients: | ||||||||||||||||
default: | ||||||||||||||||
uri: mongodb+srv://<username>:<password>@<host>/inspiration | ||||||||||||||||
|
||||||||||||||||
#. Start the Rails app by running the ``rails server`` command, then | ||||||||||||||||
complete the :guilabel:`New Idea` entry form to insert some sample | ||||||||||||||||
data into the ``inspiration.ideas`` collection. | ||||||||||||||||
|
||||||||||||||||
.. tip:: Sample Data | ||||||||||||||||
|
||||||||||||||||
To successfully demonstrate the search functionality later in | ||||||||||||||||
the tutorial, insert sample documents that contain some overlapping | ||||||||||||||||
|
To successfully demonstrate the search functionality later in | |
the tutorial, insert sample documents that contain some overlapping | |
To achieve the search functionality demonstrated later in | |
the tutorial, insert sample documents that contain some overlapping |
Outdated
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.
S:
First, update the ``Idea`` model to handle queries to our | |
database by defining the ``search`` method in the model. The | |
First, update the ``Idea`` model to handle database queries | |
by defining the ``search`` method in the model. The |
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.
reworded
Outdated
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.
S: I don't think you need the step intro sentence
In this step, you create a ``SearchesController`` to handle Atlas Search | |
requests and display results. | |
Run the following command to generate the ``SearchesController`` | |
and the ``display_results`` view file: | |
Run the following command to generate the ``SearchesController`` | |
and the ``display_results`` view file, which handle Atlas Search requests and display the results: |
Outdated
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.
S:
Run the following command to start your application: | |
In your project directory, run the following command to start your application: |
Check failure on line 307 in source/interact-data/atlas-search-tutorial.txt
GitHub Actions / TDBX Vale rules
[vale] reported by reviewdog 🐶
[MongoDB.Time24h2Digits] Show the hours, minutes, and seconds with two digits each, even if the leading digit is 0 ('1:30').
Raw Output:
{"message": "[MongoDB.Time24h2Digits] Show the hours, minutes, and seconds with two digits each, even if the leading digit is 0 ('1:30').", "location": {"path": "source/interact-data/atlas-search-tutorial.txt", "range": {"start": {"line": 307, "column": 34}}}, "severity": "ERROR"}
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.
S: since each list item is more of an action rather than a component: