Skip to content

Commit 9f6944e

Browse files
Merge #847
847: Add code samples and remove useless ones r=sanders41 a=curquiza I created [scripts to manage code samples](https://github.com/meilisearch/integration-automations/pull/164) (internal only). The script mostly compare the code samples of the SDK with the [one in the docs](https://github.com/meilisearch/documentation/blob/main/.code-samples.meilisearch.yaml) 1. I found out the following code samples are still in this repo but not used by the documentation anymore, so I removed them: ```bash meilisearch-python - 'facet_search_2' not found - 'search_parameter_guide_show_ranking_score_1' not found - 'search_parameter_guide_attributes_to_search_on_1' not found ``` 2. I found the following code samples were missing: ```bash meilisearch-python - '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 ``` Co-authored-by: curquiza <[email protected]>
2 parents a4b6513 + 20a3129 commit 9f6944e

File tree

1 file changed

+19
-35
lines changed

1 file changed

+19
-35
lines changed

.code-samples.meilisearch.yaml

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ typo_tolerance_guide_4: |-
355355
'twoTypos': 10
356356
}
357357
})
358+
search_parameter_guide_show_ranking_score_1: |-
359+
client.index('movies').search('dragon', {
360+
'showRankingScore': true
361+
})
362+
search_parameter_guide_attributes_to_search_on_1: |-
363+
client.index('movies').search('adventure', {
364+
'attributesToSearchOn': ['overview']
365+
})
358366
add_movies_json_1: |-
359367
import json
360368
@@ -372,11 +380,6 @@ landing_getting_started_1: |-
372380
{ 'id': 5, 'title': 'Moana' },
373381
{ 'id': 6, 'title': 'Philadelphia'}
374382
])
375-
documents_guide_add_movie_1: |-
376-
client.index('movies').add_documents([{
377-
'movie_id': '123sq178',
378-
'title': 'Amélie Poulain'
379-
}])
380383
getting_started_check_task_status: |-
381384
client.get_task(0)
382385
getting_started_add_documents_md: |-
@@ -464,22 +467,20 @@ getting_started_configure_settings: |-
464467
'_geo'
465468
]
466469
})
467-
getting_started_communicating_with_a_protected_instance: |-
468-
client = Client('http://localhost:7700', 'apiKey')
469-
client.index('movies').search()
470470
getting_started_faceting: |-
471-
client.index('movies').update_faceting_settings({'maxValuesPerFacet': 2})
471+
client.index('movies').update_faceting_settings({
472+
'maxValuesPerFacet': 2,
473+
'sortFacetValuesBy': {
474+
'*': 'count'
475+
}
476+
})
472477
getting_started_pagination: |-
473478
client.index('movies').update_pagination_settings({'maxTotalHits': 500})
474479
filtering_update_settings_1: |-
475480
client.index('movies').update_filterable_attributes([
476481
'director',
477482
'genres',
478483
])
479-
faceted_search_facets_1: |-
480-
client.index('movies').search('Batman', {
481-
'facets': ['genres']
482-
})
483484
faceted_search_walkthrough_filter_1: |-
484485
client.index('movies').search('thriller', {
485486
'filter': [['genres = Horror', 'genres = Mystery'], 'director = "Jordan Peele"']
@@ -494,26 +495,6 @@ faceted_search_1: |-
494495
client.index('books').search('classic', {
495496
'facets': ['genres', 'rating', 'language']
496497
})
497-
faceted_search_2: |-
498-
client.multi_search(
499-
[
500-
{
501-
'indexUid': 'books',
502-
'facets': ['language', 'genres', 'author', 'format'],
503-
'filter': '(language = English AND language = French) OR genres = Fiction'
504-
},
505-
{
506-
'indexUid': 'books',
507-
'facets': ['language'],
508-
'filter': 'genres = Fiction'
509-
},
510-
{
511-
'indexUid': 'books',
512-
'facets': ['genres'],
513-
'filter': 'language = English OR language = French'
514-
},
515-
]
516-
)
517498
post_dump_1: |-
518499
client.create_dump()
519500
phrase_search_1: |-
@@ -644,10 +625,11 @@ update_faceting_settings_1: |-
644625
params = {
645626
'maxValuesPerFacet': 2,
646627
'sortFacetValuesBy': {
647-
'*': 'count'
628+
'*': 'count',
629+
'genres': 'count'
648630
}
649631
}
650-
client.index('movies').update_faceting_settings(params)
632+
client.index('books').update_faceting_settings(params)
651633
reset_faceting_settings_1: |-
652634
client.index('books').reset_faceting_settings()
653635
synonyms_guide_1: |-
@@ -697,5 +679,7 @@ facet_search_1: |-
697679
client.index('books').facet_search('fiction', 'genres', {
698680
'filter': 'rating > 3'
699681
})
682+
facet_search_2: |-
683+
client.index('books').update_faceting_settings({ 'sortFacetValuesBy': { 'genres': 'count' } })
700684
facet_search_3: |-
701685
client.index('books').facet_search('c', 'genres')

0 commit comments

Comments
 (0)