Skip to content

Commit b58d038

Browse files
v0.21: update .code-samples.meilisearch.yaml (#1025)
* v0.21: update `.code-samples.meilisearch.yaml` update curl examples, update names, change search parameter Matches example * Respond to feedback on .code-samples Add new sample for phrase search and update highlighting sample so that highlighting occurs closer to the start of the value (more clear) * Update facetFilters syntax, finalize phrase search sample * Update .code-samples.meilisearch.yaml Co-authored-by: cvermand <[email protected]> * Update .code-samples.meilisearch.yaml Co-authored-by: cvermand <[email protected]> * Fix typo and add intro readme to .code-samples * Update code samples template Co-authored-by: Tommy <[email protected]> Co-authored-by: cvermand <[email protected]>
1 parent e7acdaf commit b58d038

File tree

2 files changed

+42
-33
lines changed

2 files changed

+42
-33
lines changed

.code-samples.meilisearch.yaml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
# This code-samples file is used by the MeiliSearch documentation
2+
# Every example written here will be automatically fetched by
3+
# the documentation on build
4+
# You can read more at https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
5+
---
16
get_one_index_1: |-
27
curl \
38
-X GET 'http://localhost:7700/indexes/movies'
4-
list_all_indexes_1: |1-
9+
list_all_indexes_1: |-
510
curl \
611
-X GET 'http://localhost:7700/indexes'
712
create_an_index_1: |-
@@ -84,11 +89,10 @@ update_settings_1: |-
8489
-X POST 'http://localhost:7700/indexes/movies/settings' \
8590
--data '{
8691
"rankingRules": [
87-
"typo",
8892
"words",
93+
"typo",
8994
"proximity",
9095
"attribute",
91-
"wordsPosition",
9296
"exactness",
9397
"desc(release_date)",
9498
"desc(rank)"
@@ -170,19 +174,19 @@ update_distinct_attribute_1: |-
170174
reset_distinct_attribute_1: |-
171175
curl \
172176
-X DELETE 'http://localhost:7700/indexes/movies/settings/distinct-attribute'
173-
get_attributes_for_faceting_1: |-
177+
get_filterable_attributes_1: |-
174178
curl \
175-
-X GET 'http://localhost:7700/indexes/movies/settings/attributes-for-faceting'
176-
update_attributes_for_faceting_1: |-
179+
-X GET 'http://localhost:7700/indexes/movies/settings/filterable-attributes'
180+
update_filterable_attributes_1: |-
177181
curl \
178-
-X POST 'http://localhost:7700/indexes/movies/settings/attributes-for-faceting' \
182+
-X POST 'http://localhost:7700/indexes/movies/settings/filterable-attributes' \
179183
--data '[
180184
"genres",
181185
"director"
182186
]'
183-
reset_attributes_for_faceting_1: |-
187+
reset_filterable_attributes_1: |-
184188
curl \
185-
-X DELETE 'http://localhost:7700/indexes/movies/settings/attributes-for-faceting'
189+
-X DELETE 'http://localhost:7700/indexes/movies/settings/filterable-attributes'
186190
get_searchable_attributes_1: |-
187191
curl \
188192
-X GET 'http://localhost:7700/indexes/movies/settings/searchable-attributes'
@@ -252,16 +256,16 @@ field_properties_guide_displayed_1: |-
252256
}'
253257
filtering_guide_1: |-
254258
curl 'http://localhost:7700/indexes/movies/search' \
255-
--data '{ "q": "Avengers", "filters": "release_date > 795484800" }'
259+
--data '{ "q": "Avengers", "filter": "release_date > 795484800" }'
256260
filtering_guide_2: |-
257261
curl 'http://localhost:7700/indexes/movies/search' \
258-
--data '{ "q":"Batman", "filters": "release_date > 795484800 AND (director = \"Tim Burton\" OR director = \"Christopher Nolan\")" }'
262+
--data '{ "q":"Batman", "filter": "release_date > 795484800 AND (director = \"Tim Burton\" OR director = \"Christopher Nolan\")" }'
259263
filtering_guide_3: |-
260264
curl 'http://localhost:7700/indexes/movies/search' \
261-
--data '{ "q": "horror", "filters": "director = \"Jordan Peele\"" }'
265+
--data '{ "q": "horror", "filter": "director = \"Jordan Peele\"" }'
262266
filtering_guide_4: |-
263267
curl 'http://localhost:7700/indexes/movies/search' \
264-
--data '{ "q": "Planet of the Apes", "filters": "rating >= 3 AND (NOT director = \"Tim Burton\")" }' \
268+
--data '{ "q": "Planet of the Apes", "filter": "rating >= 3 AND (NOT director = \"Tim Burton\")" }' \
265269
search_parameter_guide_query_1: |-
266270
curl 'http://localhost:7700/indexes/movies/search' \
267271
--data '{ "q": "shifu" }'
@@ -279,16 +283,16 @@ search_parameter_guide_crop_1: |-
279283
--data '{ "q": "shifu", "attributesToCrop": ["overview"], "cropLength": 10 }'
280284
search_parameter_guide_highlight_1: |-
281285
curl 'http://localhost:7700/indexes/movies/search' \
282-
--data '{ "q": "shifu", "attributesToHighlight": ["overview"] }'
286+
--data '{ "q": "winter feast", "attributesToHighlight": ["overview"] }'
283287
search_parameter_guide_filter_1: |-
284288
curl 'http://localhost:7700/indexes/movies/search' \
285-
--data '{ "q": "n", "filters": "title = Nightshift" }'
289+
--data '{ "q": "n", "filter": "title = Nightshift" }'
286290
search_parameter_guide_filter_2: |-
287291
curl 'http://localhost:7700/indexes/movies/search' \
288-
--data '{ "q": "shifu", "filters": "title=\"Kung Fu Panda\"" }'
292+
--data '{ "q": "shifu", "filter": "title=\"Kung Fu Panda\"" }'
289293
search_parameter_guide_matches_1: |-
290294
curl 'http://localhost:7700/indexes/movies/search' \
291-
--data '{ "q": "shifu", "attributesToHighlight": ["overview"], "matches": true }'
295+
--data '{ "q": "winter feast", "matches": true }'
292296
settings_guide_synonyms_1: |-
293297
curl \
294298
-X POST 'http://localhost:7700/indexes/tops/settings' \
@@ -313,11 +317,10 @@ settings_guide_ranking_rules_1: |-
313317
-X POST 'http://localhost:7700/indexes/movies/settings' \
314318
--data '{
315319
"rankingRules": [
316-
"typo",
317320
"words",
321+
"typo",
318322
"proximity",
319323
"attribute",
320-
"wordsPosition",
321324
"exactness",
322325
"asc(release_date)",
323326
"desc(rank)"
@@ -366,7 +369,7 @@ search_guide_1: |-
366369
--data '{ "q": "shifu", "limit": 5, "offset": 10 }'
367370
search_guide_2: |-
368371
curl 'http://localhost:7700/indexes/movies/search' \
369-
--data '{ "q": "Avengers", "filters": "release_date > 795484800" }'
372+
--data '{ "q": "Avengers", "filter": "release_date > 795484800" }'
370373
getting_started_add_documents_md: |-
371374
```bash
372375
curl \
@@ -382,35 +385,38 @@ faceted_search_update_settings_1: |-
382385
curl \
383386
-X POST 'http://localhost:7700/indexes/movies/settings' \
384387
--data '{
385-
"attributesForFaceting": [
388+
"filterableAttributes": [
386389
"director",
387390
"genres"
388391
]
389392
}'
390-
faceted_search_facet_filters_1: |-
393+
faceted_search_filter_1: |-
391394
curl 'http://localhost:7700/indexes/movies/search' \
392-
--data '{ "q": "thriller", "facetFilters": [["genres:Horror", "genres:Mystery"], "director:Jordan Peele"] }'
395+
--data '{ "q": "thriller", "filter": [["genres = Horror", "genres = Mystery"], "director = \"Jordan Peele\""] }'
393396
faceted_search_facets_distribution_1: |-
394397
curl --get 'http://localhost:7700/indexes/movies/search' \
395398
--data '{ "q": "Batman", "facetsDistribution": ["genres"] }'
396-
faceted_search_walkthrough_attributes_for_faceting_1: |-
399+
faceted_search_walkthrough_filterable_attributes_1: |-
397400
curl \
398401
-X POST 'http://localhost:7700/indexes/movies/settings' \
399402
--data '{
400-
"attributesForFaceting": [
403+
"filterableAttributes": [
401404
"director",
402405
"producer",
403406
"genres",
404407
"production_companies"
405408
]
406409
}'
407-
faceted_search_walkthrough_facet_filters_1: |-
410+
faceted_search_walkthrough_filter_1: |-
408411
curl 'http://localhost:7700/indexes/movies/search' \
409-
--data '{ "q": "thriller", "facetFilters": [["genres:Horror", "genres:Mystery"], "director:Jordan Peele"] }'
412+
--data '{ "q": "thriller", "filter": [["genres = Horror", "genres = Mystery"], "director = \"Jordan Peele\""] }'
410413
faceted_search_walkthrough_facets_distribution_1: |-
411414
curl 'http://localhost:7700/indexes/movies/search' \
412415
--data '{ "q": "Batman", "facetsDistribution": ["genres"] }'
413416
post_dump_1: |-
414417
curl -X POST 'http://localhost:7700/dumps'
415418
get_dump_status_1: |-
416419
curl -X GET 'http://localhost:7700/dumps/20201101-110357260/status'
420+
phrase_search_1: |-
421+
curl -X POST 'http://localhost:7700/indexes/movies/search' \
422+
--data '{ "q": "\"african american\" horror" }'

.vuepress/public/sample-template.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ reset_distinct_attribute_1: |-
3737
get_searchable_attributes_1: |-
3838
update_searchable_attributes_1: |-
3939
reset_searchable_attributes_1: |-
40-
get_attributes_for_faceting_1: |-
41-
update_attributes_for_faceting_1: |-
42-
reset_attributes_for_faceting_1: |-
40+
get_filterable_attributes_1: |-
41+
update_filterable_attributes_1: |-
42+
reset_filterable_attributes_1: |-
4343
get_displayed_attributes_1: |-
4444
update_displayed_attributes_1: |-
4545
reset_displayed_attributes_1: |-
@@ -75,9 +75,12 @@ search_guide_2: |-
7575
getting_started_add_documents_md: |-
7676
getting_started_search_md: |-
7777
faceted_search_update_settings_1: |-
78-
faceted_search_facet_filters_1: |-
78+
faceted_search_filter_1: |-
7979
faceted_search_facets_distribution_1: |-
80-
faceted_search_walkthrough_attributes_for_faceting_1: |-
81-
faceted_search_walkthrough_facet_filters_1: |-
80+
faceted_search_walkthrough_filterable_attributes_1: |-
81+
faceted_search_walkthrough_filter_1: |-
8282
faceted_search_walkthrough_facets_distribution_1: |-
8383
add_movies_json_1: |-
84+
post_dump_1: |-
85+
get_dump_status_1: |-
86+
phrase_search_1: |-

0 commit comments

Comments
 (0)