diff --git a/docs/5-search-operators/08-mix-and-match.mdx b/docs/5-search-operators/08-mix-and-match.mdx index 61442611..57d82fea 100644 --- a/docs/5-search-operators/08-mix-and-match.mdx +++ b/docs/5-search-operators/08-mix-and-match.mdx @@ -1,4 +1,4 @@ -# 📘 Mixing and matching +# 📘 Mixing and Matching The whole value of using these operators comes from combining them to create search results that are more relevant to your users. @@ -16,8 +16,7 @@ Using the `compound` operator, you can mix and match some of the operators you'v } ``` -`must` -Clauses that must match to for a document to be included in the results. The returned score is the sum of the scores of all the subqueries in the clause. +`must`: Clauses that must match for a document to be included in the results. The returned score is the sum of the scores of all the subqueries in the clause. Maps to the AND boolean operator. @@ -26,10 +25,9 @@ Clauses that must not match for a document to be included in the results. mustNo Maps to the AND NOT boolean operator. -`should` -Clauses that you prefer to match in documents that are included in the results. Documents that contain a match for a should clause have higher scores than documents that don't contain a should clause. The returned score is the sum of the scores of all the subqueries in the clause. +`should`: Clauses that you prefer to match in documents that are included in the results. Documents that contain a match for a should clause have higher scores than documents that don't contain a should clause. The returned score is the sum of the scores of all the subqueries in the clause. -Say you wanted to search for a book that contains "cats" in the title, but you prefer having shorter books, you can use the following query: +Say you wanted to search for a book that contains "cats" in the title, but you prefer having shorter books. You can use the following query: ```js { @@ -58,11 +56,11 @@ Say you wanted to search for a book that contains "cats" in the title, but you p } ``` -This will return all books that contain "cats" in the title, but will prefer shorter books. It will still return longer books, but they will be scored lower than shorter books. +This will return all books that contain "cats" in the title but will prefer shorter books. It will still return longer books, but they will be scored lower than shorter books. ## Compound with scoring -You can also use the `compound` operator with the `score` option to control how the scores of the subqueries are combined. Say the library has a monthly theme, and they want to promote the books that have a specific word in the synopsis. This month, the theme is "bears". Try to write a search query that will return the books a user queried for, but those who contain the word "bear" in it will have a higher score and come at the top. Try to have a book about Winnie the Pooh come first when a user searches for "honey". +You can also use the `compound` operator with the `score` option to control how the scores of the subqueries are combined. Say the library has a monthly theme, and they want to promote the books that have a specific word in the synopsis. This month, the theme is bears. Try to write a search query that will return the books a user queried for, but those that contain the word "bear" will have a higher score and come at the top. Try to have a book about Winnie the Pooh come first when a user searches for "honey."
Click here to see the answer @@ -96,4 +94,4 @@ You can also use the `compound` operator with the `score` option to control how ``` -
\ No newline at end of file +