From e995548cfeb74f23fc16ca45ef9dcaeab9515176 Mon Sep 17 00:00:00 2001 From: alallema Date: Tue, 22 Mar 2022 11:31:26 +0100 Subject: [PATCH 01/11] Replace description into overview and genre into genres --- .code-samples.meilisearch.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 2609b3b7..83712949 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -87,13 +87,13 @@ update_settings_1: |- 'distinctAttribute': 'movie_id', 'searchableAttributes': [ 'title', - 'description', - 'genre' + 'overview', + 'genres' ], 'displayedAttributes': [ 'title', - 'description', - 'genre', + 'overview', + 'genres', 'release_date' ], 'sortableAttributes': [ @@ -164,7 +164,7 @@ get_searchable_attributes_1: |- update_searchable_attributes_1: |- client.index('movies').update_searchable_attributes([ 'title', - 'description', + 'overview', 'uid' ]) reset_searchable_attributes_1: |- @@ -174,8 +174,8 @@ get_displayed_attributes_1: |- update_displayed_attributes_1: |- client.index('movies').update_displayed_attributes([ 'title', - 'description', - 'genre', + 'overview', + 'genres', 'release_date' ]) reset_displayed_attributes_1: |- @@ -203,15 +203,15 @@ field_properties_guide_searchable_1: |- client.index('movies').update_settings({ 'searchableAttributes': [ 'title', - 'description', - 'genre' + 'overview', + 'genres' ]}) field_properties_guide_displayed_1: |- client.index('movies').update_settings({ 'displayedAttributes': [ 'title', - 'description', - 'genre', + 'overview', + 'genres', 'release_date' ]}) filtering_guide_1: |- @@ -301,16 +301,16 @@ settings_guide_searchable_1: |- client.index('movies').update_settings({ 'searchableAttributes': [ 'title', - 'description', - 'genre' + 'overview', + 'genres' ] }) settings_guide_displayed_1: |- client.index('movies').update_settings({ 'displayedAttributes': [ 'title', - 'description', - 'genre', + 'overview', + 'genres', 'release_date' ] }) From 6722b031e540e73ae776a927f74eea7a38076344 Mon Sep 17 00:00:00 2001 From: alallema Date: Tue, 22 Mar 2022 16:32:34 +0100 Subject: [PATCH 02/11] Add new getting started code-samples --- .code-samples.meilisearch.yaml | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 83712949..dfd45bc9 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -332,6 +332,8 @@ documents_guide_add_movie_1: |- 'movie_id': '123sq178', 'title': 'Amélie Poulain' }]) +getting_started_check_task_status_md: |- + client.index('movies').get_task(0) search_guide_1: |- client.index('movies').search('shifu', { 'limit': 5, @@ -364,6 +366,71 @@ getting_started_search_md: |- ``` [About this SDK](https://github.com/meilisearch/meilisearch-python/) +getting_started_add_meteorites_md: |- + import json + + json_file = open('meteorites.json') + movies = json.load(json_file) + client.index('meteorites').add_documents(meteorites) +getting_started_update_ranking_rules_md: |- + client.index('movies').update_ranking_rules([ + 'exactness', + 'words', + 'typo', + 'proximity', + 'attribute', + 'sort', + 'release_date:asc', + 'rank:desc' + ]) +getting_started_update_displayed_attributes_md: |- + client.index('movies').update_displayed_attributes([ + 'title', + 'overview', + 'poster' + ]) +getting_started_update_searchable_attributes_md: |- + client.index('movies').update_searchable_attributes([ + 'title' + ]) +getting_started_update_stop_words_md: |- + client.index('movies').update_stop_words(['the']) +getting_started_synonyms_md: |- + client.index('movies').update_synonyms({ + "winnie": ["piglet"], + "piglet": ["winnie"] + }) +getting_started_filtering_md: |- + client.index('meteorites').search('', { + 'filter': 'mass < 200' + }) +getting_started_geoRadius_md: |- + client.index('meteorites').search('', { + 'filter': '_geoRadius(46.9480, 7.4474, 210000)' + }) +getting_started_geoPoint_md: |- + client.index('meteorites').search('', { + 'sort': ['_geoPoint(48.8583701,2.2922926):asc'] + }) +getting_started_sorting_md: |- + client.index('meteorites').search('', { + 'filter': 'mass < 200', + 'sort': ['mass:asc'] + }) +getting_started_configure_settings: |- + client.index('movies').meteorites({ + 'filterableAttributes': [ + 'mass', + '_geo' + ], + 'sortableAttributes': [ + 'mass', + '_geo' + ] + }) +getting_started_communicating_with_a_protected_instance: |- + client = Client('http://127.0.0.1:7700', 'apiKey') + client.index('movies').search() faceted_search_update_settings_1: |- client.index('movies').update_filterable_attributes([ 'director', From 9f33355538a4d8f8f54818ce93fc3f0fb69ab009 Mon Sep 17 00:00:00 2001 From: alallema Date: Tue, 5 Apr 2022 18:02:54 +0200 Subject: [PATCH 03/11] Remove unused code samples --- .code-samples.meilisearch.yaml | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index dfd45bc9..825c15f8 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -223,10 +223,6 @@ filtering_guide_2: |- 'filter': 'release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")' }) filtering_guide_3: |- - client.index('movies').search('horror', { - 'filter': 'director = "Jordan Peele"' - }) -filtering_guide_4: |- client.index('movies').search('Planet of the Apes', { 'filter': 'rating >= 3 AND (NOT director = "Tim Burton")' }) @@ -253,14 +249,6 @@ search_parameter_guide_highlight_1: |- client.index('movies').search('winter feast', { 'attributesToHighlight': ['overview'] }) -search_parameter_guide_filter_1: |- - client.index('movies').search('n', { - 'filter': 'title = Nightshift' - }) -search_parameter_guide_filter_2: |- - client.index('movies').search('shifu', { - 'filter': 'title = "Kung Fu Panda"' - }) search_parameter_guide_matches_1: |- client.index('movies').search('winter feast', { 'matches': 'true' @@ -334,15 +322,6 @@ documents_guide_add_movie_1: |- }]) getting_started_check_task_status_md: |- client.index('movies').get_task(0) -search_guide_1: |- - client.index('movies').search('shifu', { - 'limit': 5, - 'offset': 10 - }) -search_guide_2: |- - client.index('movies').search('Avengers', { - 'filter': 'release_date > 795484800' - }) getting_started_add_documents_md: |- ```bash pip3 install meilisearch @@ -444,21 +423,10 @@ faceted_search_facets_distribution_1: |- client.index('movies').search('Batman', { 'facetsDistribution': ['genres'] }) -faceted_search_walkthrough_filterable_attributes_1: |- - client.index('movies').update_filterable_attributes([ - 'director', - 'producer', - 'genres', - 'production_companies' - ]) faceted_search_walkthrough_filter_1: |- client.index('movies').search('thriller', { 'filter': [['genres = Horror', 'genres = Mystery'], 'director = "Jordan Peele"'] }) -faceted_search_walkthrough_facets_distribution_1: |- - client.index('movies').search('Batman', { - 'facetsDistribution': ['genres'] - }) post_dump_1: |- client.create_dump() get_dump_status_1: |- From 85cd7808db32e0e45c8c5a6804be8a217aff9f22 Mon Sep 17 00:00:00 2001 From: alallema Date: Tue, 5 Apr 2022 18:09:40 +0200 Subject: [PATCH 04/11] Update the primary key examples --- .code-samples.meilisearch.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 825c15f8..b9760718 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -483,6 +483,16 @@ geosearch_guide_sort_usage_2: |- client.index('restaurants').search('', { 'sort': ['_geoPoint(48.8583701,2.2922926):asc', 'rating:desc'] }) +document_guide_create_index_primary_key: |- + client.create_index('movies', {'primaryKey': 'reference_number'}) +document_guide_add_document_primary_key: |- + client.index('movies').add_documents([{ + 'id': 287947, + 'title': 'Shazam', + 'poster': 'https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg', + 'overview': 'A boy is given the ability to become an adult superhero in times of need with a single magic word.', + 'release_date': '2019-03-23' + }], reference_number) security_guide_search_key_1: |- client = Client('http://127.0.0.1:7700', 'apiKey') client.index('patient_medical_records').search() From 73f9905a8c15af3aacc0c135f129af3c34aeb803 Mon Sep 17 00:00:00 2001 From: alallema Date: Tue, 5 Apr 2022 18:16:52 +0200 Subject: [PATCH 05/11] Add landing_getting_started_1 sample --- .code-samples.meilisearch.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index b9760718..7290445c 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -315,6 +315,17 @@ add_movies_json_1: |- json_file = open('movies.json') movies = json.load(json_file) client.index('movies').add_documents(movies) +landing_getting_started_1: |- + client = meilisearch.Client('http://127.0.0.1:7700') + + client.index('movies').add_documents([ + { "id": 1, "title": 'Carol' }, + { "id": 2, "title": 'Wonder Woman' }, + { "id": 3, "title": 'Life of Pi' }, + { "id": 4, "title": 'Mad Max: Fury Road' }, + { "id": 5, "title": 'Moana' }, + { "id": 6, "title": 'Philadelphia'} + ]) documents_guide_add_movie_1: |- client.index('movies').add_documents([{ 'movie_id': '123sq178', From 8869a3069c2f97a920aab8b779bccbb06a35eb63 Mon Sep 17 00:00:00 2001 From: alallema Date: Wed, 6 Apr 2022 11:40:58 +0200 Subject: [PATCH 06/11] Update geosearch guide --- .code-samples.meilisearch.yaml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 7290445c..d43f1b19 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -356,13 +356,13 @@ getting_started_search_md: |- ``` [About this SDK](https://github.com/meilisearch/meilisearch-python/) -getting_started_add_meteorites_md: |- +getting_started_add_meteorites: |- import json json_file = open('meteorites.json') movies = json.load(json_file) client.index('meteorites').add_documents(meteorites) -getting_started_update_ranking_rules_md: |- +getting_started_update_rankingRules: |- client.index('movies').update_ranking_rules([ 'exactness', 'words', @@ -373,36 +373,36 @@ getting_started_update_ranking_rules_md: |- 'release_date:asc', 'rank:desc' ]) -getting_started_update_displayed_attributes_md: |- +getting_started_update_displayedAttributes: |- client.index('movies').update_displayed_attributes([ 'title', 'overview', 'poster' ]) -getting_started_update_searchable_attributes_md: |- +getting_started_update_searchableAttributes: |- client.index('movies').update_searchable_attributes([ 'title' ]) -getting_started_update_stop_words_md: |- +getting_started_update_stop_words: |- client.index('movies').update_stop_words(['the']) -getting_started_synonyms_md: |- +getting_started_synonyms: |- client.index('movies').update_synonyms({ "winnie": ["piglet"], "piglet": ["winnie"] }) -getting_started_filtering_md: |- +getting_started_filtering: |- client.index('meteorites').search('', { 'filter': 'mass < 200' }) -getting_started_geoRadius_md: |- +getting_started_geoRadius: |- client.index('meteorites').search('', { 'filter': '_geoRadius(46.9480, 7.4474, 210000)' }) -getting_started_geoPoint_md: |- +getting_started_geoPoint: |- client.index('meteorites').search('', { 'sort': ['_geoPoint(48.8583701,2.2922926):asc'] }) -getting_started_sorting_md: |- +getting_started_sorting: |- client.index('meteorites').search('', { 'filter': 'mass < 200', 'sort': ['mass:asc'] @@ -476,11 +476,11 @@ geosearch_guide_filter_settings_1: |- ]) geosearch_guide_filter_usage_1: |- client.index('restaurants').search('', { - 'filter': '_geoRadius(45.4628328, 9.1076931, 2000)' + 'filter': '_geoRadius(45.472735, 9.184019, 2000)' }) geosearch_guide_filter_usage_2: |- client.index('restaurants').search('', { - 'filter': '_geoRadius(45.4628328, 9.1076931, 2000) AND type = pizza' + 'filter': '_geoRadius(45.472735, 9.184019, 2000) AND type = pizza' }) geosearch_guide_sort_settings_1: |- client.index('restaurants').update_sortable_attributes([ @@ -488,11 +488,11 @@ geosearch_guide_sort_settings_1: |- ]) geosearch_guide_sort_usage_1: |- client.index('restaurants').search('', { - 'sort': ['_geoPoint(48.8583701,2.2922926):asc'] + 'sort': ['_geoPoint(48.8561446,2.2978204):asc'] }) geosearch_guide_sort_usage_2: |- client.index('restaurants').search('', { - 'sort': ['_geoPoint(48.8583701,2.2922926):asc', 'rating:desc'] + 'sort': ['_geoPoint(48.8561446,2.2978204):asc', 'rating:desc'] }) document_guide_create_index_primary_key: |- client.create_index('movies', {'primaryKey': 'reference_number'}) From f5f977e5f7736961e1b7f74483220c72e796ae27 Mon Sep 17 00:00:00 2001 From: alallema Date: Wed, 6 Apr 2022 11:56:17 +0200 Subject: [PATCH 07/11] Fix typo and Markdown --- .code-samples.meilisearch.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index d43f1b19..02f16b48 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -316,7 +316,7 @@ add_movies_json_1: |- movies = json.load(json_file) client.index('movies').add_documents(movies) landing_getting_started_1: |- - client = meilisearch.Client('http://127.0.0.1:7700') + client = meilisearch.Client('http://127.0.0.1:7700', 'masterKey') client.index('movies').add_documents([ { "id": 1, "title": 'Carol' }, @@ -332,7 +332,9 @@ documents_guide_add_movie_1: |- 'title': 'Amélie Poulain' }]) getting_started_check_task_status_md: |- + ```python client.index('movies').get_task(0) + ``` getting_started_add_documents_md: |- ```bash pip3 install meilisearch @@ -360,7 +362,7 @@ getting_started_add_meteorites: |- import json json_file = open('meteorites.json') - movies = json.load(json_file) + meteorites = json.load(json_file) client.index('meteorites').add_documents(meteorites) getting_started_update_rankingRules: |- client.index('movies').update_ranking_rules([ @@ -503,7 +505,7 @@ document_guide_add_document_primary_key: |- 'poster': 'https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg', 'overview': 'A boy is given the ability to become an adult superhero in times of need with a single magic word.', 'release_date': '2019-03-23' - }], reference_number) + }], 'reference_number') security_guide_search_key_1: |- client = Client('http://127.0.0.1:7700', 'apiKey') client.index('patient_medical_records').search() From 453932539b443f5e37be6f526b4c593e4c9ba828 Mon Sep 17 00:00:00 2001 From: alallema Date: Wed, 6 Apr 2022 12:58:46 +0200 Subject: [PATCH 08/11] Replace double quote by simple quote --- .code-samples.meilisearch.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 02f16b48..a2f4e3bf 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -319,12 +319,12 @@ landing_getting_started_1: |- client = meilisearch.Client('http://127.0.0.1:7700', 'masterKey') client.index('movies').add_documents([ - { "id": 1, "title": 'Carol' }, - { "id": 2, "title": 'Wonder Woman' }, - { "id": 3, "title": 'Life of Pi' }, - { "id": 4, "title": 'Mad Max: Fury Road' }, - { "id": 5, "title": 'Moana' }, - { "id": 6, "title": 'Philadelphia'} + { 'id': 1, 'title': 'Carol' }, + { 'id': 2, 'title': 'Wonder Woman' }, + { 'id': 3, 'title': 'Life of Pi' }, + { 'id': 4, 'title': 'Mad Max: Fury Road' }, + { 'id': 5, 'title': 'Moana' }, + { 'id': 6, 'title': 'Philadelphia'} ]) documents_guide_add_movie_1: |- client.index('movies').add_documents([{ @@ -389,8 +389,8 @@ getting_started_update_stop_words: |- client.index('movies').update_stop_words(['the']) getting_started_synonyms: |- client.index('movies').update_synonyms({ - "winnie": ["piglet"], - "piglet": ["winnie"] + 'winnie': ['piglet'], + 'piglet': ['winnie'] }) getting_started_filtering: |- client.index('meteorites').search('', { From c56da25b0676d61ceb9bd8a90681fd8ecade9442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C3=A9lie?= Date: Wed, 6 Apr 2022 17:52:03 +0200 Subject: [PATCH 09/11] Update .code-samples.meilisearch.yaml Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> --- .code-samples.meilisearch.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index a2f4e3bf..0f029e87 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -165,7 +165,7 @@ update_searchable_attributes_1: |- client.index('movies').update_searchable_attributes([ 'title', 'overview', - 'uid' + 'genres' ]) reset_searchable_attributes_1: |- client.index('movies').reset_searchable_attributes() From 531a29e0209c46b4f2da79915184866f5f963932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C3=A9lie?= Date: Wed, 6 Apr 2022 17:52:35 +0200 Subject: [PATCH 10/11] Update .code-samples.meilisearch.yaml Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> --- .code-samples.meilisearch.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 0f029e87..614ba2ca 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -410,7 +410,7 @@ getting_started_sorting: |- 'sort': ['mass:asc'] }) getting_started_configure_settings: |- - client.index('movies').meteorites({ + client.index('meteorites').update_settings({ 'filterableAttributes': [ 'mass', '_geo' @@ -500,7 +500,7 @@ document_guide_create_index_primary_key: |- client.create_index('movies', {'primaryKey': 'reference_number'}) document_guide_add_document_primary_key: |- client.index('movies').add_documents([{ - 'id': 287947, + 'reference_number': 287947, 'title': 'Shazam', 'poster': 'https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg', 'overview': 'A boy is given the ability to become an adult superhero in times of need with a single magic word.', From 0a84edca713d1b916f3778f172c886a730b7667a Mon Sep 17 00:00:00 2001 From: alallema Date: Thu, 7 Apr 2022 14:10:48 +0200 Subject: [PATCH 11/11] Remove every _md --- .code-samples.meilisearch.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 614ba2ca..226a7081 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -8,9 +8,9 @@ get_one_index_1: |- list_all_indexes_1: |- client.get_indexes() create_an_index_1: |- - client.create_index('movies', {'primaryKey': 'movie_id'}) + client.create_index('movies', {'primaryKey': 'id'}) update_an_index_1: |- - client.index('movies').update(primary_key='movie_review_id') + client.index('movies').update(primary_key='id') delete_an_index_1: |- client.delete_index('movies') // OR @@ -331,10 +331,8 @@ documents_guide_add_movie_1: |- 'movie_id': '123sq178', 'title': 'Amélie Poulain' }]) -getting_started_check_task_status_md: |- - ```python +getting_started_check_task_status: |- client.index('movies').get_task(0) - ``` getting_started_add_documents_md: |- ```bash pip3 install meilisearch