Skip to content

Commit b66fa3a

Browse files
Merge #1580
1580: Fix code samples (remove useless, and add missing) r=curquiza a=curquiza I created [scripts to manage code samples](https://github.com/meilisearch/integration-automations/pull/164) (internal only) I found out the following code samples are still in this repo but not used by the documentation anymore: ```bash meilisearch-js - 'documents_guide_add_movie_1' not found in documentation - 'getting_started_communicating_with_a_protected_instance' not found in documentation - 'faceted_search_facets_1' not found in documentation - 'faceted_search_2' not found in documentation ``` And the missing code samples ``` meilisearch-js - 'getting_started_typo_tolerance' not found ``` I also changed some `"` into `'` Co-authored-by: curquiza <[email protected]>
2 parents 412d9a7 + 6f18e5e commit b66fa3a

File tree

1 file changed

+19
-46
lines changed

1 file changed

+19
-46
lines changed

.code-samples.meilisearch.yaml

Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
---
66
synonyms_guide_1: |-
77
client.index('movies').updateSynonyms({
8-
"great": ["fantastic"],
9-
"fantastic": ["great"]
8+
'great': ['fantastic'],
9+
'fantastic': ['great']
1010
})
1111
date_guide_index_1: |-
1212
const games = require('./games.json')
@@ -35,8 +35,8 @@ delete_an_index_1: |-
3535
client.deleteIndex('movies')
3636
swap_indexes_1: |-
3737
client.swapIndexes([
38-
{ "indexes": ["indexA", "indexB"] },
39-
{ "indexes": ["indexX", "indexY"] }
38+
{ 'indexes': ['indexA', 'indexB'] },
39+
{ 'indexes': ['indexX', 'indexY'] }
4040
])
4141
get_one_document_1: |-
4242
client
@@ -106,18 +106,18 @@ async_guide_filter_by_date_1: |-
106106
client.getTasks({ afterEnqueuedAt: '2020-10-11T11:49:53.000Z' })
107107
async_guide_multiple_filters_1: |-
108108
client.getTasks({
109-
indexUids: ["movies"],
110-
types: ["documentAdditionOrUpdate","documentDeletion"],
111-
statuses: ["processing"]
109+
indexUids: ['movies'],
110+
types: ['documentAdditionOrUpdate','documentDeletion'],
111+
statuses: ['processing']
112112
})
113113
async_guide_filter_by_ids_1: |-
114114
client.getTasks({ uids: [5, 10, 13] })
115115
async_guide_filter_by_statuses_1: |-
116-
client.getTasks({ statuses: ["failed", "canceled"] })
116+
client.getTasks({ statuses: ['failed', 'canceled'] })
117117
async_guide_filter_by_types_1: |-
118-
client.getTasks({ types: ["dumpCreation", "indexSwap"] })
118+
client.getTasks({ types: ['dumpCreation', 'indexSwap'] })
119119
async_guide_filter_by_index_uids_1: |-
120-
client.getTasks({ indexUids: ["movies"] })
120+
client.getTasks({ indexUids: ['movies'] })
121121
get_all_tasks_paginating_1: |-
122122
client.getTasks({ limit: 2, from: 10 })
123123
get_all_tasks_paginating_2: |-
@@ -400,11 +400,6 @@ typo_tolerance_guide_4: |-
400400
add_movies_json_1: |-
401401
const movies = require('./movies.json')
402402
client.index('movies').addDocuments(movies).then((res) => console.log(res))
403-
documents_guide_add_movie_1: |-
404-
client.index('movies').addDocuments([{
405-
movie_id: '123sq178',
406-
title: 'Amelie Poulain'
407-
}])
408403
primary_field_guide_update_document_primary_key: |-
409404
client.updateIndex('books', {
410405
primaryKey: 'title'
@@ -492,9 +487,6 @@ getting_started_update_displayed_attributes: |-
492487
'overview',
493488
'poster'
494489
])
495-
getting_started_communicating_with_a_protected_instance: |-
496-
const client = new MeiliSearch('http://localhost:7700', 'apiKey')
497-
client.index('movies').search()
498490
getting_started_add_meteorites: |-
499491
const meteorites = require('./meteorites.json')
500492
@@ -517,13 +509,19 @@ getting_started_faceting: |-
517509
client.index('movies').updateFaceting({
518510
maxValuesPerFacet: 2,
519511
sortFacetValuesBy: {
520-
'*': "count"
512+
'*': 'count'
513+
}
514+
})
515+
getting_started_typo_tolerance: |-
516+
client.index('movies').updateTypoTolerance({
517+
minWordSizeForTypos: {
518+
oneTypo: 4
521519
}
522520
})
523521
getting_started_filtering: |-
524522
client.index('meteorites').search('', { filter: 'mass < 200' })
525523
getting_started_pagination: |-
526-
client.index("movies").updatePagination({ maxTotalHits: 500 })
524+
client.index('movies').updatePagination({ maxTotalHits: 500 })
527525
get_filterable_attributes_1: |-
528526
client.index('movies').getFilterableAttributes()
529527
update_filterable_attributes_1: |-
@@ -540,11 +538,6 @@ filtering_update_settings_1: |-
540538
'director',
541539
'genres'
542540
])
543-
faceted_search_facets_1: |-
544-
client.index('movies')
545-
.search('Batman', {
546-
facets: ['genres']
547-
})
548541
faceted_search_walkthrough_filter_1: |-
549542
client.index('movies')
550543
.search('thriller', {
@@ -554,26 +547,6 @@ faceted_search_update_settings_1: |-
554547
client.index('movie_ratings').updateFilterableAttributes(['genres', 'rating', 'language'])
555548
faceted_search_1: |-
556549
client.index('books').search('classic', { facets: ['genres', 'rating', 'language'] })
557-
faceted_search_2: |-
558-
client.multiSearch({
559-
queries: [
560-
{
561-
indexUid: 'books',
562-
facets: ['language', 'genres', 'author', 'format'],
563-
filter: "(language = English AND language = French) OR genres = Fiction"
564-
},
565-
{
566-
indexUid: 'books',
567-
facets: ['language'],
568-
filter: 'genres = Fiction'
569-
},
570-
{
571-
indexUid: 'books',
572-
facets: ['genres'],
573-
filter: 'language = English OR language = French'
574-
}
575-
]
576-
})
577550
post_dump_1: |-
578551
client.createDump()
579552
phrase_search_1: |-
@@ -603,7 +576,7 @@ sorting_guide_sort_parameter_2: |-
603576
})
604577
sorting_guide_sort_nested_1: |-
605578
client.index('books').search('science fiction', {
606-
"sort": ["rating.users:asc"],
579+
'sort': ['rating.users:asc'],
607580
})
608581
get_sortable_attributes_1: |-
609582
client.index('books').getSortableAttributes()

0 commit comments

Comments
 (0)