diff --git a/docs/2-search/3-test-search.mdx b/docs/2-search/3-test-search.mdx index f04399a5..b931ba09 100644 --- a/docs/2-search/3-test-search.mdx +++ b/docs/2-search/3-test-search.mdx @@ -19,9 +19,9 @@ and look at the results you get. You can see that you get a list of books back including: -* High-Flavor, Low-Fat Vegetarian _Cooking_ -* _Cooking_ Secrets of the CIA: Favorite Recipes from the Culinary Institu… +* Pennsylvania Dutch _Cooking_: A Mennonite Community Cookbook * Semi-Homemade _Cooking_: Quick, Marvelous Meals and Nothing is Made from… +* Cookin' Cajun _Cooking_ School Cookbook - Creole and Cajun Cuisine from … All those results match the word _cooking_. Notice how capitalization doesn't matter. Neither does the placement of the word in the title. The search index is smart enough to find the word _cooking_ in all those titles. diff --git a/docs/7-vector-search/9-filtering.mdx b/docs/7-vector-search/9-filtering.mdx index ccbf6bab..bf0842e8 100644 --- a/docs/7-vector-search/9-filtering.mdx +++ b/docs/7-vector-search/9-filtering.mdx @@ -48,30 +48,28 @@ In this case, we already have our index and we're going to edit it in the JSON e ```js { - "mappings": { - "dynamic": true, - "fields": { - "embeddings": { - "dimensions": 384, - "similarity": "cosine", - "type": "knnVector" - }, - "language": { - "normalizer": "none", - "type": "token" - } + "fields": [ + { + "type": "vector", + "path": "embeddings", + "numDimensions": 1536, + "similarity": "cosine" + }, + { + "type": "filter", + "path": "language" } - } + ] } ``` -The only difference is that we've added this part, stating that `language` should be indexed as a [token](https://www.mongodb.com/docs/atlas/atlas-search/field-types/token-type/), not as a string (we're not going to do full text search here, but Vector Search) +The only difference is that we've added this part, stating that `language` should be indexed as a [filter](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/#about-the-filter-type). ```js -"language": { - "normalizer": "none", - "type": "token" -} + { + "type": "filter", + "path": "language" + } ``` Add that new aggregation pipeline in your code (`server/src/controllers/books.ts` inside the now familiar `searchBooks` method) and when searching, you'll get semantic results written in Spanish. diff --git a/static/img/screenshots/2-search/3-test-search/2-search-tester.png b/static/img/screenshots/2-search/3-test-search/2-search-tester.png index cbc5aabc..99b3f2bb 100644 Binary files a/static/img/screenshots/2-search/3-test-search/2-search-tester.png and b/static/img/screenshots/2-search/3-test-search/2-search-tester.png differ