Skip to content

Commit 129a361

Browse files
committed
more work tidying up the exercises
1 parent d8965b3 commit 129a361

File tree

8 files changed

+40
-37
lines changed

8 files changed

+40
-37
lines changed

docs/30_Index_configuration/8_Exercises/1_.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ What numeric value can be used to match one of the documents?
126126

127127
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c2313d0df60f0254e5d31">🔗 Playground link: `range`</Playground>
128128

129-
There are *two* issues to fix in this exercises. What's the correct field name? And what's wrong with
129+
There are *two* issues to fix in this exercise. What's the correct field name? And what's wrong with
130130
the one of the range values?
131131

132132
<details>

docs/40_Analysis/8_Exercises/2_.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Exercises: English
22

3-
Adjust the index configuration without touching the pipeline or query
3+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c721ee97570c2714a07ee">🔗 Playground link: "searches" query does not match "Search"</Playground>
4+
5+
Adjust the index configuration without touching the pipeline or query.
6+
The default `lucene.standard` does basic, language-insensitive, analysis. There's a better language-specific analyzer choice that will solve this challenge.
47

5-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c721ee97570c2714a07ee">“searches” query does not match “Search” with `lucene.standard`</Playground>
68
<details>
79
<summary>Solution</summary>
810
<div>
911
```js
1012
"analyzer": "lucene.english"
1113
```
12-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c3f2ae97570c2714a07ea">solution using `lucene.english` analyzer</Playground>
14+
🔗 <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c3f2ae97570c2714a07ea">solution using `lucene.english` analyzer</Playground>
1315
</div>
1416
</details>
1517

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
# Exercises: Various languages
1+
# Exercises: Non-English languages
22

3-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c70b3d0df60f0254e5d43">configure an appropriate analyzer</Playground>
3+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c70b3d0df60f0254e5d43">🔗 Playground link: configure an appropriate analyzer</Playground>
44
<details>
55
<summary>Solution</summary>
66
<div>
77
```js
88
"analyzer": "lucene.portuguese"
99
```
10-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c7123d0df60f0254e5d45">solution using the `lucene.portuguese` analyzer</Playground>
10+
🔗 <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c7123d0df60f0254e5d45">solution using the `lucene.portuguese` analyzer</Playground>
1111
</div>
1212
</details>
13-
14-
## TODO
15-
16-
Add more language examples:
17-
* Chinese
18-
* Diacritic handling (spanish)
19-
* Arabic: https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67c8851a5bc7a2f8060be53f
20-

docs/50_Querying/8_Exercises/1_.mdx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,30 @@ in looser/fuzzier ways, then tackle these exercises.
55

66
# matchCriteria
77

8-
Loosen up this query so the document matches: <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8e77e97570c2714a07f2">all terms do no match</Playground>
8+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8e77e97570c2714a07f2">🔗 Playground link: all terms do no match</Playground>
9+
10+
Loosen up this query so the document matches.
11+
912
<details>
1013
<summary>Solution</summary>
1114
<div>
1215
```js
1316
"matchCriteria": "any"
1417
```
15-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8ef8e97570c2714a07f4">solution</Playground>
18+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8ef8e97570c2714a07f4">🔗 solution</Playground>
1619
</div>
1720
</details>
1821

1922

2023
# fuzzy
2124

22-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c915dd0df60f0254e5d51">Adjust the `text` operator settings so that this document matches</Playground>
25+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c915dd0df60f0254e5d51">🔗 Playground link: Adjust the `text` operator settings so that this document matches</Playground>
2326
<details>
2427
<summary>Solution</summary>
2528
<div>
2629
```js
2730
"fuzzy": {}
2831
```
2932
</div>
30-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67b58ffb3cface474919d054">solution</Playground>
33+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67b58ffb3cface474919d054">🔗 solution</Playground>
3134
</details>

docs/50_Querying/8_Exercises/2_.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Phrases match terms in proximity to one another, either exact order with no word
44

55
HINT: See the [`phrase` operator docs](https://www.mongodb.com/docs/atlas/atlas-search/phrase/) for these exercises.
66

7-
Fix this <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8ff7e97570c2714a07f8">not close enough phrase match</Playground>
7+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8ff7e97570c2714a07f8">🔗 Playground link: not close enough phrase match</Playground>
88
<details>
99
<summary>Solution</summary>
1010
<div>
@@ -16,10 +16,6 @@ Fix this <Playground url="https://search-playground.corp.mongodb.com/tools/code-
1616
But you can't adjust what the users query for, so the configuration or search operators need
1717
to be adjusted.
1818

19-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c909ad0df60f0254e5d49">solution using phrase `slop`</Playground>
19+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c909ad0df60f0254e5d49">🔗 solution using phrase `slop`</Playground>
2020
</div>
2121
</details>
22-
23-
# TODO
24-
25-
There's another setting than "slop" which allows out of order. It looks like we need to add it to the exercise/solution

docs/50_Querying/8_Exercises/3_.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## `wildcard`
44

5-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d1e0cd20b1632e508742aa">words that starts-with not matching as expected</Playground>
5+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d1e0cd20b1632e508742aa">🔗 Playground link: words that starts-with not matching as expected</Playground>
66
<details>
77
<summary>Solution</summary>
88
<div>
@@ -13,13 +13,13 @@
1313

1414
And `allowAnalyzedField: true` needs to be set, allowing searches when using a tokenizing analyzer.
1515

16-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67d1e0f5643f61797f19d31b">solution</Playground>
16+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67d1e0f5643f61797f19d31b">🔗 solution</Playground>
1717
</div>
1818
</details>
1919

2020
## ``regex``
2121

22-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67d1dff6643f61797f19d319">Full string regex not working as expected</Playground>
22+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67d1dff6643f61797f19d319">🔗 Playground link: Full string regex not working as expected</Playground>
2323
<details>
2424
<summary>Solution</summary>
2525
<div>
@@ -29,7 +29,7 @@
2929
Matching needs to occur across the full string, and thus needs to be `lucene.keyword`
3030
analyzed so that the full string is indexed as a single unit.
3131

32-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/679caadcd0df60f0254e5d62">solution</Playground>
32+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/679caadcd0df60f0254e5d62">🔗 solution</Playground>
3333
</div>
3434
</details>
3535

docs/60_Relevancy/8_Exercises.mdx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@
22

33
## project the score
44

5+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2ef3c808223b17a90bd7a">🔗 Playground link: score not projected</Playground>
6+
57
Fix this Playground so that the `score` being projected is the relevancy score Atlas Search uses for default sorting.
68

7-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2ef3c808223b17a90bd7a">score not projected</Playground>
89
<details>
910
<summary>Solution</summary>
1011
<div>
1112
The score is available in the pipeline `$meta` context as `searchScore`.
1213
```js
1314
{"$meta": "searchScore"}
1415
```
15-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2ef7e643f61797f19d33e">solution</Playground>
16+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2ef7e643f61797f19d33e">🔗 solution</Playground>
1617
</div>
1718
</details>
1819

1920

2021
## project the score details
2122

22-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2ee9b643f61797f19d33c">add the score details into the results</Playground>
23+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2ee9b643f61797f19d33c">🔗 Playground link: add the score details into the results</Playground>
24+
25+
Enable the score details and project them into the results.
26+
2327
<details>
2428
<summary>Solution</summary>
2529
<div>
@@ -34,13 +38,16 @@ Fix this Playground so that the `score` being projected is the relevancy score A
3438
"$meta": "searchScoreDetails"
3539
}
3640
```
37-
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2eec2808223b17a90bd78">solution</Playground>
41+
<Playground url="https://search-playground.mongodb.com/tools/code-sandbox/snapshots/67d2eec2808223b17a90bd78">🔗 solution</Playground>
3842
</div>
3943
</details>
4044

4145
## score/sort by the `weight` field
4246

43-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67d2eddb643f61797f19d33a">task: set the search (relevance) score to the value of our custom `weight` field</Playground>
47+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67d2eddb643f61797f19d33a">🔗 Playground link: task: score documents by document field</Playground>
48+
49+
Set the search (relevance) score to the value of the `weight` field.
50+
4451
<details>
4552
<summary>Solution</summary>
4653
<div>
@@ -52,6 +59,6 @@ Fix this Playground so that the `score` being projected is the relevancy score A
5259
}
5360
}
5461
```
55-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679cb6fdd0df60f0254e5d6a">solution</Playground>
62+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679cb6fdd0df60f0254e5d6a">🔗 solution</Playground>
5663
</div>
5764
</details>

docs/70_Data_Modeling/8_Exercises.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## Only make searchable a specific subset of fields
44

5-
First, see how <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67b5ccc0828ad15116bcce21">a string field is automatically searchable</Playground> but now make it so only fields under the `metadata` structure are indexed (and thus this query would then fail to find any matching documents)
5+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67b5ccc0828ad15116bcce21">🔗 Playground link: a dynamic string field is automatically searchable</Playground>
6+
7+
Make it so only fields under the `metadata` structure are indexed (and thus this query would then fail to find any matching documents). This is an exercise where no matching documents (an empty array `[]`) is the goal, rather than matching on a field that should not be indexed.
8+
69
<details>
710
<summary>Solution</summary>
811
<div>
@@ -22,6 +25,6 @@ First, see how <Playground url="https://search-playground.corp.mongodb.com/tools
2225
}
2326
}
2427
```
25-
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67b5cd163cface474919d070">solution</Playground>
28+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67b5cd163cface474919d070">🔗 solution</Playground>
2629
</div>
2730
</details>

0 commit comments

Comments
 (0)