Skip to content

Commit 2db842c

Browse files
committed
Pre local cleanup
1 parent cf4fc36 commit 2db842c

File tree

10 files changed

+78
-30
lines changed

10 files changed

+78
-30
lines changed

docs/20_Intro_to_Atlas_Search/2_aggregation_stages.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@ Results are returned in descending **score** order or in an optional `sort` orde
1515

1616
## $searchMeta
1717

18-
TODO: It was mentioned that searchMeta perhaps doesn't warrant (much) coverage in this
19-
workshop. Perhaps only mention but do no cover?
20-
2118
Returns a single document of search result metadata including count of matching documents
2219
and any facets requested. No actual collection documents are returned.
2320

2421
The `$searchMeta` stage performs the same search that `$search` does,
2522
but only returns the results metadata, not actual matching documents.
2623
Results metadata includes the count of matching results and facets.
2724
This same metadata is available when using `$search` too,
28-
accessible in the $$SEARCH_META context variable.
25+
accessible in the `$$SEARCH_META` context variable.
2926

3027
## Post $search-stages
3128

32-
* Such as $sort, $group, etc any stage that consumes **all** documents from previous stage.
33-
* $limit, $addFields, $project and the like are fine as they only operate on one doc at a time
29+
* Warning: stages such as `$sort`, `$group`, and others will consumes **all** documents from previous stage
30+
(and could be a performance issue)
31+
* `$limit`, `$addFields`, `$project` and the like are fine as they only operate on one doc at a time
3432
or cut-off

docs/30_Index_configuration/5_string.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This field type is paired with an operator by the same name to provide partial,
2626
Careful though - while this field type sounds alluring and does match sub-strings, it does not by
2727
itself provide good relevancy or highlighting and can explode the index size.
2828

29-
The `autocomplete` field type and operator use complex analysis and querying technique build upon the Analysis techniques in the next section and will be covered a bit more there.
29+
The `autocomplete` field type and operator use complex analysis and querying techniques, building upon the analysis techniques in the next section and will be covered a bit more there.
3030

3131
## `string`
3232

docs/30_Index_configuration/9_advanced.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,4 @@ To map that GeoJSON `location` field to a `geo` type in Atlas Search:
4343

4444
Operates on numbers and dates, but trickier than `equals`, `in`, and `range`
4545
* <Link to="https://www.mongodb.com/docs/atlas/atlas-search/near/">near operator</Link>
46-
* Playground TODO: number `near`
47-
* Playground TODO: date `near`
4846

docs/40_Analysis/9_advanced.mdx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See also: <Link to="https://www.mongodb.com/solutions/solutions-library/as-you-t
1111

1212
## partial matching
1313
* <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/68a752755ec5d0d84cbffc3b">🔗 `regex`</Playground>
14-
* `wildcard`: TODO
14+
* `wildcard`: similar to `regex`
1515

1616
## `moreLikeThis`
1717

@@ -28,12 +28,5 @@ https://search-playground.mongodb.com/tools/code-playground/snapshots/6683c8bc4a
2828

2929
# `searchAnalyzer` vs. `analyzer` and which one is chosen when
3030

31-
# Using scoreDetails to glimpse analysis in action:
32-
33-
....
34-
35-
# Configuration options on strings
36-
37-
* `storedSource`
38-
* `synonyms`
39-
31+
* generally use the same analyzer for both (by specifying *only* `analyzer`)
32+
* when index analysis emits multiple tokens per word, a different `searchAnalyzer` could be warranted

docs/50_Querying/1_index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ A phrase match can be a bit loose, such that it can match even if there are addi
3232

3333
## synonyms
3434

35+
When configured and requested, synoyms are applied at query-time with `text` and `phrase`.
3536

37+
Documentation: <Link to="https://www.mongodb.com/docs/atlas/atlas-search/synonyms/">Define Synonym Mappings in Your Atlas Search Index</Link>

docs/50_Querying/7_compound.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ A `compound` operator holds these four sets of clauses, each an array of any oth
1616

1717
If there's only a single `should` clause in all of a `compound`, it effectively becomes an implicit `must`.
1818

19-
TODO: add some blurb about `minimumShouldMatch`
19+
When there are multiple `should` clauses, at least `minimumShouldMatch` of them must match; only one clause must match with a default `minimumShouldMatch` of 0.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Look back at the first chapter of this section to understand how `text` can be configured to match
44
in looser/fuzzier ways, then tackle these exercises.
55

6-
# matchCriteria
6+
## matchCriteria
77

88
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c8e77e97570c2714a07f2">🔗 Playground link: all terms do no match</Playground>
99

@@ -20,7 +20,7 @@ Loosen up this query so the document matches.
2020
</details>
2121

2222

23-
# fuzzy
23+
## fuzzy
2424

2525
<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>
2626
<details>
Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,63 @@
11
# Exercises: `compound`
22

3-
##
3+
## minimumShouldMatch
44

5+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/68ca7d929998a1882cce707c">🔗 Playground link: adjust minimumShouldMatch</Playground>
6+
<details>
7+
<summary>Solution</summary>
8+
<div>
9+
```js
10+
"minimumShouldMatch": 2
11+
```
12+
13+
Increase minimumShouldMatch to increase precision of results.
14+
</div>
15+
</details>
16+
17+
## filter
18+
19+
You've got Products, each with a `name` and a `category`. A user is looking for accessories for a "camera", not actual cameras. Let's guide the user:
20+
21+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/68ca7ff59998a1882cce7080">🔗 Playground link: filter by category</Playground>
22+
<details>
23+
<summary>Solution</summary>
24+
25+
You might first try adding an `equals` on `category` within `compound.filter`:
26+
<div>
27+
```js
28+
filter: [
29+
{
30+
equals: {
31+
path: "category",
32+
value: "Accessories"
33+
}
34+
}
35+
]
36+
```
37+
</div>
38+
39+
Which leads us to this, which isn't yet working:
40+
<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/68ca7f902af20a4fd56dbf22">🔗 Playground link: filter by category not working yet</Playground>
41+
42+
Note the surprising effect of querying a path that was not indexed specifically for that operator!
43+
44+
Using `equals` on a string field effectively requires that it be mapped as type `token`:
45+
<div>
46+
```js
47+
{
48+
"mappings": {
49+
"dynamic": true,
50+
"fields": {
51+
"category": [
52+
{
53+
"type": "token"
54+
}
55+
]
56+
}
57+
}
58+
}
59+
```
60+
</div>
61+
62+
With this final solution: <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/68ca7f009998a1882cce707e">🔗 Playground link: filter by category solution</Playground>
63+
</details>

docs/50_Querying/9_advanced.mdx

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

33
## `autocomplete`
44

5-
This seems an aluring one to run with, but understand that it uses some advanced Lucene analysis
5+
This seems like an appealing operator, but understand that it uses some advanced Lucene analysis
66
techniques with shingling and ngramming that apply differently between index and search time. It's recommended to explore and understand the capabilities and limitations with other textual analysis configurations and query constructions and then come back to this one with good understanding of the tradeoffs of hyper-indexing to facilitate direct short query to index lookup to simpler indexing with more complex query-time searches.
77

88
## `text.fuzzy` options
@@ -11,8 +11,4 @@ A myriad of parameters. Just don't forget about mixing and matching different le
1111

1212
## `queryString`
1313

14-
yeah, why not! TODO
15-
16-
## `moreLikeThis`
17-
18-
TODO
14+
The `queryString` operator is niche, using specialized, and brittle, syntax. We strongly recommend using the other operators, in conjuction with `compound`, to build a robust query.

docs/90_Summary.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Congratulations!
44

55
## Search Demo Builder
66

7-
Do a demonstration of this tool, discussing it's sweet spot
7+
Check out the
8+
[Search Demo Builder](https://search-playground.mongodb.com/tools/search-demo-builder/snapshots/new) - a handy way to jump start a project.
89

910
## Search topics not covered here
1011

@@ -13,4 +14,5 @@ Do a demonstration of this tool, discussing it's sweet spot
1314
* Highlighting
1415
* Pagination
1516
* partitioned indexes / index enrichment (new preview feature)
17+
* more flexible field mapping (coming soon)
1618

0 commit comments

Comments
 (0)