diff --git a/docs/1-full-text-search/4-how-search-works.mdx b/docs/1-full-text-search/4-how-search-works.mdx index 6cdb730f..cd9fea71 100644 --- a/docs/1-full-text-search/4-how-search-works.mdx +++ b/docs/1-full-text-search/4-how-search-works.mdx @@ -4,7 +4,7 @@ Atlas Search uses inverted indexes to support text search queries. An inverted i ## Simple string search -When you do a simple query in your database using a LIKE operator, or a regular expression, the database has to scan every document in the collection to find the matching documents. This is a slow process, and it gets slower as the number of documents in the collection increases. +When you do a simple query in your database using a LIKE operator, or a regular expression, the database has to scan every document in the collection, or record in the Index, to find the matching documents. This is a slow process, and it gets slower as the number of documents in the collection increases. ![Simple String Search](/img/1-full-text-search/3-string-search.gif) diff --git a/docs/2-search/2-search-index.mdx b/docs/2-search/2-search-index.mdx index 208c8f19..68d6e594 100644 --- a/docs/2-search/2-search-index.mdx +++ b/docs/2-search/2-search-index.mdx @@ -18,7 +18,11 @@ The first step of building the search index is selecting the configuration metho Next, you need to select a name and data source for your index. Change the name to **fulltextsearch** and select the database **library** and the collection **books**. - + The final step allows you to review the index configuration and refine it if needed. You may also see the JSON that was generated from your configuration by clicking **View JSON**. @@ -31,7 +35,7 @@ The final step allows you to review the index configuration and refine it if nee ``` :::info -The index is using dynamic field mappings. We didn't configure any explicit (static) mappings between the fields in the documents and the search index. That's why Atlas created dynamic mappings that match the data in the documents to some common field types such as `double`, `string`, `array`, `int`, and `double`. +The index is using dynamic field mappings. We didn't configure any explicit (static) mappings between the fields in the documents and the search index. That's why Atlas created dynamic mappings that match the data in the documents to some common field types such as `string`, `array`, `int`, and `double`. Dynamic mappings are useful when you're just getting started with Atlas Search or if your schema changes regularly. However, they take up more space compared to static mappings. ::: @@ -48,4 +52,3 @@ When your search index's status changes to `Ready`, you'll be able to see more i Once your new index's status is `Ready`, you can move to the next step. - diff --git a/docs/4-add-to-app/1-add-to-app.mdx b/docs/4-add-to-app/1-add-to-app.mdx index f34bbee1..912105d7 100644 --- a/docs/4-add-to-app/1-add-to-app.mdx +++ b/docs/4-add-to-app/1-add-to-app.mdx @@ -26,7 +26,8 @@ public async searchBooks(query: string): Promise { return books; } ``` -While this code works to a certain extent, it is less than optimal. As the dataset grows, the performance of this query will degrade because it will have to scan the entire collection. You cannot query the index with a regular expression. Furthermore, the query only matches on the title and only for the exact sequence of characters. + +While this code works to a certain extent, it is less than optimal. As the dataset grows, the performance of this query will degrade because it will have to scan the entire Index. If you query the index with a regular expression, it will need to scan each entry. Furthermore, the query only matches on the title and only for the exact sequence of characters. Change this code to use the search index instead. You will need to use the `$search` stage in the aggregation pipeline. Have your search cover the title, the author name, and the genres array. @@ -53,6 +54,7 @@ public async searchBooks(query: string): Promise { return books; } ``` +