diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 81c50bf26..e674d2a39 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -2,12 +2,16 @@ # Every example written here will be automatically fetched by # the documentation on build --- +## BEGIN /references/api +# get_indexes_indexUid get_one_index_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies' +# get_indexes list_all_indexes_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes?limit=3' +# post_indexes create_an_index_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes' \ @@ -16,20 +20,25 @@ create_an_index_1: |- "uid": "movies", "primaryKey": "id" }' +# patch_indexes_indexUid update_an_index_1: |- curl \ -X PATCH 'MEILISEARCH_URL/indexes/movies' \ -H 'Content-Type: application/json' \ --data-binary '{ "primaryKey": "id" }' +# delete_indexes_indexUid delete_an_index_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies' +# get_indexes_indexUid_documents_documentId get_one_document_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/documents/25684?fields=id,title,poster,release_date' +# get_indexes_indexUid_documents get_documents_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/documents?limit=2&filter=genres=action' +# post_indexes_indexUid_documents add_or_replace_documents_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/movies/documents' \ @@ -43,6 +52,7 @@ add_or_replace_documents_1: |- "release_date": "2019-03-23" } ]' +# put_indexes_indexUid_documents add_or_update_documents_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/movies/documents' \ @@ -54,12 +64,15 @@ add_or_update_documents_1: |- "genres": "comedy" } ]' +# delete_indexes_indexUid_documents delete_all_documents_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies/documents' +# delete_indexes_indexUid_documents_id delete_one_document_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies/documents/25684' +# post_indexes_indexUid_documents_delete_batch delete_documents_by_batch_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/movies/documents/delete-batch' \ @@ -70,17 +83,21 @@ delete_documents_by_batch_1: |- 437035, 363869 ]' +# post_indexes_indexUid_search search_post_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/movies/search' \ -H 'Content-Type: application/json' \ --data-binary '{ "q": "american ninja" }' +# get_indexes_indexUid_search search_get_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/search?q=american%20ninja' +# get_tasks get_all_tasks_1: |- curl \ -X GET 'MEILISEARCH_URL/tasks' +# get_tasks_taskUid get_task_1: |- curl \ -X GET 'MEILISEARCH_URL/tasks/1' @@ -90,14 +107,17 @@ get_all_tasks_paginating_1: |- get_all_tasks_paginating_2: |- curl \ -X GET 'MEILISEARCH_URL/tasks?limit=2&from=8 +# get_keys_uidOrKey get_one_key_1: |- curl \ -X GET 'MEILISEARCH_URL/keys/6062abda-a5aa-4414-ac91-ecd7944c0f8d' \ -H 'Authorization: Bearer MASTER_KEY' +# get_keys get_all_keys_1: |- curl \ -X GET 'MEILISEARCH_URL/keys?limit=3' \ -H 'Authorization: Bearer MASTER_KEY' +# post_keys create_a_key_1: |- curl \ -X POST 'MEILISEARCH_URL/keys' \ @@ -109,6 +129,7 @@ create_a_key_1: |- "indexes": ["products"], "expiresAt": "2042-04-02T00:42:42Z" }' +# patch_keys_uidOrKey update_a_key_1: |- curl \ -X PATCH 'MEILISEARCH_URL/keys/6062abda-a5aa-4414-ac91-ecd7944c0f8d' \ @@ -118,13 +139,18 @@ update_a_key_1: |- "name": "Products/Reviews API key", "description": "Manage documents: Products/Reviews API key" }' +# delete_keys_uidOrKey delete_a_key_1: |- curl \ -X DELETE 'MEILISEARCH_URL/keys/6062abda-a5aa-4414-ac91-ecd7944c0f8d' \ -H 'Authorization: Bearer MASTER_KEY' + +### BEGIN settings + subroutes +# get_indexes_indexUid_settings get_settings_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/settings' +# patch_indexes_indexUid_settings update_settings_1: |- curl \ -X PATCH 'MEILISEARCH_URL/indexes/movies/settings' \ @@ -183,12 +209,15 @@ update_settings_1: |- }, "searchCutoffMs": 150 }' +# delete_indexes_indexUid_settings reset_settings_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies/settings' +# get_indexes_indexUid_settings_synonyms get_synonyms_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/settings/synonyms' +# put_indexes_indexUid_settings_synonyms update_synonyms_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/movies/settings/synonyms' \ @@ -204,12 +233,15 @@ update_synonyms_1: |- ], "wow": ["world of warcraft"] }' +# delete_indexes_indexUid_settings_synonyms reset_synonyms_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/synonyms' +# get_indexes_indexUid_settings_stop_words get_stop_words_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/settings/stop-words' +# put_indexes_indexUid_settings_stop_words update_stop_words_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/movies/settings/stop-words' \ @@ -219,12 +251,15 @@ update_stop_words_1: |- "of", "to" ]' +# delete_indexes_indexUid_settings_stop_words reset_stop_words_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/stop-words' +# get_indexes_indexUid_settings_ranking_rules get_ranking_rules_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/settings/ranking-rules' +# put_indexes_indexUid_settings_ranking_rules update_ranking_rules_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/movies/settings/ranking-rules' \ @@ -239,87 +274,552 @@ update_ranking_rules_1: |- "release_date:asc", "rank:desc" ]' +# delete_indexes_indexUid_settings_ranking_rules reset_ranking_rules_1: |- curl \ -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/ranking-rules' +# get_indexes_indexUid_settings_distinct_attribute get_distinct_attribute_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/shoes/settings/distinct-attribute' +# put_indexes_indexUid_settings_distinct_attribute update_distinct_attribute_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/shoes/settings/distinct-attribute' \ -H 'Content-Type: application/json' \ --data-binary '"skuid"' +# delete_indexes_indexUid_settings_distinct_attribute reset_distinct_attribute_1: |- curl \ - -X DELETE 'MEILISEARCH_URL/indexes/shoes/settings/distinct-attribute' -get_filterable_attributes_1: |- + -X DELETE 'MEILISEARCH_URL/indexes/shoes/settings/distinct-attribute' +# get_indexes_indexUid_settings_filterable_attributes +get_filterable_attributes_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' +# put_indexes_indexUid_settings_filterable_attributes +update_filterable_attributes_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + "genres", + "director", + { + "attributePatterns": ["*_ratings"], + "features": { + "facetSearch": false, + "filter": { + "equality": true, + "comparison": false + } + } + } + ]' +# delete_indexes_indexUid_settings_filterable_attributes +reset_filterable_attributes_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' +# get_indexes_indexUid_settings_searchable_attributes +get_searchable_attributes_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/movies/settings/searchable-attributes' +# put_indexes_indexUid_settings_searchable_attributes +update_searchable_attributes_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/movies/settings/searchable-attributes' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + "title", + "overview", + "genres" + ]' +# delete_indexes_indexUid_settings_searchable_attributes +reset_searchable_attributes_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/searchable-attributes' +# get_indexes_indexUid_settings_displayed_attributes +get_displayed_attributes_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/movies/settings/displayed-attributes' +# put_indexes_indexUid_settings_displayed_attributes +update_displayed_attributes_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/movies/settings/displayed-attributes' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + "title", + "overview", + "genres", + "release_date" + ]' +# delete_indexes_indexUid_settings_displayed_attributes +reset_displayed_attributes_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/displayed-attributes' +# get_indexes_indexUid_settings_sortable_attributes +get_sortable_attributes_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/books/settings/sortable-attributes' +# put_indexes_indexUid_settings_sortable_attributes +update_sortable_attributes_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/books/settings/sortable-attributes' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + "price", + "author" + ]' +# delete_indexes_indexUid_settings_sortable_attributes +reset_sortable_attributes_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/books/settings/sortable-attributes' +# get_indexes_indexUid_settings_typo_tolerance +get_typo_tolerance_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' +# patch_indexes_indexUid_settings_typo_tolerance +update_typo_tolerance_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "minWordSizeForTypos": { + "oneTypo": 4, + "twoTypos": 10 + }, + "disableOnAttributes": ["title"] + }' +# delete_indexes_indexUid_settings_typo_tolerance +reset_typo_tolerance_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' +# get_indexes_indexUid_settings_pagination +get_pagination_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/books/settings/pagination' +# patch_indexes_indexUid_settings_pagination +update_pagination_settings_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/indexes/books/settings/pagination' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "maxTotalHits": 100 + }' +# delete_indexes_indexUid_settings_pagination +reset_pagination_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/books/settings/pagination' +# get_indexes_indexUid_settings_faceting +get_faceting_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/books/settings/faceting' +# patch_indexes_indexUid_settings_faceting +update_faceting_settings_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/indexes/books/settings/faceting' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "maxValuesPerFacet": 2, + "sortFacetValuesBy": { + "*": "alpha", + "genres": "count" + } + }' +# delete_indexes_indexUid_settings_faceting +reset_faceting_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/books/settings/faceting' +# get_indexes_indexUid_settings_separator_tokens +get_separator_tokens_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/articles/settings/separator-tokens' +# put_indexes_indexUid_settings_separator_tokens +update_separator_tokens_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/articles/settings/separator-tokens' \ + -H 'Content-Type: application/json' \ + --data-binary '["|", "…"]' +# delete_indexes_indexUid_settings_separator_tokens +reset_separator_tokens_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/articles/settings/separator-tokens' +# get_indexes_indexUid_settings_non_separator_tokens +get_non_separator_tokens_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/articles/settings/non-separator-tokens' +# put_indexes_indexUid_settings_non_separator_tokens +update_non_separator_tokens_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/articles/settings/non-separator-tokens' \ + -H 'Content-Type: application/json' \ + --data-binary '["@", "#"]' +# delete_indexes_indexUid_settings_non_separator_tokens +reset_non_separator_tokens_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/articles/settings/non-separator-tokens' +# get_indexes_indexUid_settings_dictionary +get_dictionary_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/books/settings/dictionary' +# put_indexes_indexUid_settings_dictionary +update_dictionary_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/books/settings/dictionary' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + "J. R. R.", + "W. E. B." + ]' +# delete_indexes_indexUid_settings_dictionary +reset_dictionary_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/books/settings/dictionary' +# get_indexes_indexUid_settings_proximity_precision +get_proximity_precision_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/books/settings/proximity-precision' +# put_indexes_indexUid_settings_proximity_precision +update_proximity_precision_settings_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/books/settings/proximity-precision' \ + -H 'Content-Type: application/json' \ + --data-binary '"byAttribute"' +# delete_indexes_indexUid_settings_proximity_precision +reset_proximity_precision_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/books/settings/proximity-precision' +# get_indexes_indexUid_settings_facet_search +get_facet_search_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/facet-search' +# put_indexes_indexUid_settings_facet_search +update_facet_search_settings_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/INDEX_UID/settings/facet-search' \ + -H 'Content-Type: application/json' \ + --data-binary 'false' +# delete_indexes_indexUid_settings_facet_search +reset_facet_search_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/facet-search' +# get_indexes_indexUid_settings_prefix_search +get_prefix_search_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' +# put_indexes_indexUid_settings_prefix_search +update_prefix_search_settings_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' \ + -H 'Content-Type: application/json' \ + --data-binary '"disabled"' +# delete_indexes_indexUid_settings_prefix_search +reset_prefix_search_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' +# get_indexes_indexUid_settings_search_cutoff_ms +get_search_cutoff_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/movies/settings/search-cutoff-ms' +# put_indexes_indexUid_settings_search_cutoff_ms +update_search_cutoff_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/movies/settings/search-cutoff-ms' \ + -H 'Content-Type: application/json' \ + --data-binary '150' +# delete_indexes_indexUid_settings_search_cutoff_ms +reset_search_cutoff_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/search-cutoff-ms' +# get_indexes_indexUid_settings_localized_attributes +get_localized_attribute_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/localized-attributes' +# put_indexes_indexUid_settings_localized_attributes +update_localized_attribute_settings_1: |- + curl \ + -X PUT 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/localized-attributes' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + {"locales": ["jpn"], "attributePatterns": ["*_ja"]} + ]' +# delete_indexes_indexUid_settings_localized_attributes +reset_localized_attribute_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/localized-attributes' +# get_indexes_indexUid_settings_embedders +get_embedders_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/embedders' +# patch_indexes_indexUid_settings_embedders +update_embedders_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/embedders' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "default": { + "source": "openAi", + "apiKey": "OPEN_AI_API_KEY", + "model": "text-embedding-3-small", + "documentTemplate": "A document titled '{{doc.title}}' whose description starts with {{doc.overview|truncatewords: 20}}" + } + }' +# delete_indexes_indexUid_settings_embedders +reset_embedders_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/embedders' +# get_indexes_indexUid_settings_vector_store +get_vector_store_settings_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/vector-store' +# patch_indexes_indexUid_settings_vector_store +update_vector_store_settings_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/indexes/INDEX_UID/settings/vector-store' \ + -H 'Content-Type: application/json' \ + --data-binary '"experimental"' +# delete_indexes_indexUid_settings_vector_store +reset_vector_store_settings_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/vector-store' +### END settings + subroutes + +# post_dumps +post_dump_1: |- + curl \ + -X POST 'MEILISEARCH_URL/dumps' +# delete_tasks +delete_tasks_1: |- + curl \ + -X DELETE 'MEILISEARCH_URL/tasks?uids=1,2' +# post_tasks_cancel +cancel_tasks_1: |- + curl \ + -X POST 'MEILISEARCH_URL/tasks/cancel?uids=1,2' +# post_swap_indexes +swap_indexes_1: |- + curl \ + -X POST 'MEILISEARCH_URL/swap-indexes' \ + -H 'Content-Type: application/json' \ + --data-binary '[ + { + "indexes": [ + "indexA", + "indexB" + ] + }, + { + "indexes": [ + "indexX", + "indexY" + ] + } + ]' +# post_multi_search +multi_search_1: |- + curl \ + -X POST 'MEILISEARCH_URL/multi-search' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "queries": [ + { + "indexUid": "movies", + "q": "pooh", + "limit": 5 + }, + { + "indexUid": "movies", + "q": "nemo", + "limit": 5 + }, + { + "indexUid": "movie_ratings", + "q": "us" + } + ] + }' +# post_indexes_indexUid_documents_fetch +get_documents_post_1: |- + curl \ + -X POST MEILISEARCH_URL/indexes/books/documents/fetch \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "filter": "(rating > 3 AND (genres = Adventure OR genres = Fiction)) AND language = English", + "fields": ["title", "genres", "rating", "language"], + "limit": 3 + }' +# post_indexes_indexUid_documents_delete +delete_documents_by_filter_1: |- + curl \ + -X POST MEILISEARCH_URL/indexes/movies/documents/delete \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "filter": "genres = action OR genres = adventure" + }' +# get_experimental_features +get_experimental_features_1: |- + curl \ + -X GET 'MEILISEARCH_URL/experimental-features/' +# patch_experimental_features +update_experimental_features_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/experimental-features/' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "metrics": true + }' +# post_indexes_indexUid_facet_search +facet_search_1: |- + curl \ + -X POST 'MEILISEARCH_URL/indexes/books/facet-search' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "facetQuery": "fiction", + "facetName": "genres", + "filter": "rating > 3" + }' +# post_snapshots +create_snapshot_1: |- + curl \ + -X POST 'MEILISEARCH_URL/snapshots' +# get_batches +get_all_batches_1: |- + curl \ + -X GET 'http://MEILISEARCH_URL/batches' +# get_batches_id +get_batch_1: |- + curl \ + -X GET 'http://MEILISEARCH_URL/batches/BATCH_UID' +# post_indexes_indexUid_similar +get_similar_post_1: |- + curl \ + -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/similar' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \ + --data-binary '{ + "id": TARGET_DOCUMENT_ID, + "embedder": "EMBEDDER_NAME" + }' +# get_indexes_indexUid_similar +get_similar_get_1: |- + curl \ + -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/similar?id=TARGET_DOCUMENT_ID&embedder=EMBEDDER_NAME' +# post_export +export_post_1: |- + curl \ + -X POST 'MEILISEARCH_URL/export' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "url": "TARGET_INSTANCE_URL", + "indexes": { + "*": { + "overrideSettings": true + } + } + }' +# get_webhooks +webhooks_get_1: |- + curl \ + -X GET 'MEILISEARCH_URL/webhooks' +# get_webhooks_uid +webhooks_get_single_1: |- curl \ - -X GET 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' -update_filterable_attributes_1: |- + -X GET 'MEILISEARCH_URL/webhooks/WEBHOOK_UUID' +# post_webhooks +webhooks_post_1: |- curl \ - -X PUT 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' \ + -X POST 'MEILISEARCH_URL/webhooks' \ -H 'Content-Type: application/json' \ - --data-binary '[ - "genres", - "director", - { - "attributePatterns": ["*_ratings"], - "features": { - "facetSearch": false, - "filter": { - "equality": true, - "comparison": false - } - } + --data-binary '{ + "url": "WEBHOOK_TARGET_URL", + "headers": { + "authorization": "SECURITY_KEY", + "referer": "https://example.com" } - ]' -reset_filterable_attributes_1: |- + }' +# patch_webhooks_uid +webhooks_patch_1: |- curl \ - -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' -get_searchable_attributes_1: |- + -X PATCH 'MEILISEARCH_URL/webhooks/WEBHOOK_UUID' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "header": { + "referer": null + } + }' +# delete_webhooks_uid +webhooks_delete_1: |- curl \ - -X GET 'MEILISEARCH_URL/indexes/movies/settings/searchable-attributes' -update_searchable_attributes_1: |- + -X DELETE 'MEILISEARCH_URL/webhooks/WEBHOOK_UUID' +# post_indexes_indexUid_compact +compact_index_1: |- curl \ - -X PUT 'MEILISEARCH_URL/indexes/movies/settings/searchable-attributes' \ - -H 'Content-Type: application/json' \ - --data-binary '[ - "title", - "overview", - "genres" - ]' -reset_searchable_attributes_1: |- + -X POST 'MEILISEARCH_URL/indexes/INDEX_UID/compact' +# get_metrics +experimental_get_metrics_1: |- curl \ - -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/searchable-attributes' -get_displayed_attributes_1: |- + -X GET 'MEILISEARCH_URL/metrics' +# post_logs_stderr +experimental_post_logs_stderr_1: |- curl \ - -X GET 'MEILISEARCH_URL/indexes/movies/settings/displayed-attributes' -update_displayed_attributes_1: |- + -X POST MEILISEARCH_URL/logs/stderr \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "target": "milli=trace,index_scheduler=info,actix_web=off" + }' +# post_logs_stream +experimental_post_logs_stream_1: |- curl \ - -X PUT 'MEILISEARCH_URL/indexes/movies/settings/displayed-attributes' \ + -X POST MEILISEARCH_URL/logs/stream \ -H 'Content-Type: application/json' \ - --data-binary '[ - "title", - "overview", - "genres", - "release_date" - ]' -reset_displayed_attributes_1: |- + --data-binary '{ + "mode": "human", + "target": "index_scheduler=trace" + }' +# delete_logs_stream +experimental_delete_logs_stream_1: |- curl \ - -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/displayed-attributes' + -X DELETE MEILISEARCH_URL/logs/stream + }' +# get_network +get_network_1: |- + curl \ + -X GET 'MEILISEARCH_URL/network' +# patch_network +update_network_1: |- + curl \ + -X PATCH 'MEILISEARCH_URL/network' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "self": "ms-00", + "remotes": { + "ms-00": { + "url": "http://INSTANCE_URL", + "searchApiKey": "INSTANCE_API_KEY" + }, + "ms-01": { + "url": "http://ANOTHER_INSTANCE_URL", + "searchApiKey": "ANOTHER_INSTANCE_API_KEY" + } + } + }' +# get_indexes_indexUid_stats get_index_stats_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/movies/stats' +# get_stats get_indexes_stats_1: |- curl \ -X GET 'MEILISEARCH_URL/stats' +# get_health get_health_1: |- curl \ -X GET 'MEILISEARCH_URL/health' +# get_version get_version_1: |- curl \ -X GET 'MEILISEARCH_URL/version' +## END /references/api + distinct_attribute_guide_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/jackets/settings/distinct-attribute' \ @@ -586,9 +1086,6 @@ faceted_search_walkthrough_filter_1: |- "director = \"Jordan Peele\"" ] }' -post_dump_1: |- - curl \ - -X POST 'MEILISEARCH_URL/dumps' phrase_search_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/movies/search' \ @@ -643,20 +1140,6 @@ sorting_guide_sort_parameter_2: |- "q": "butler", "sort": ["author:desc"] }' -get_sortable_attributes_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/books/settings/sortable-attributes' -update_sortable_attributes_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/books/settings/sortable-attributes' \ - -H 'Content-Type: application/json' \ - --data-binary '[ - "price", - "author" - ]' -reset_sortable_attributes_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/books/settings/sortable-attributes' search_parameter_guide_sort_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/books/search' \ @@ -790,23 +1273,6 @@ tenant_token_guide_search_no_sdk_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/patient_medical_records/search' \ -H 'Authorization: Bearer TENANT_TOKEN' -get_typo_tolerance_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' -update_typo_tolerance_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "minWordSizeForTypos": { - "oneTypo": 4, - "twoTypos": 10 - }, - "disableOnAttributes": ["title"] - }' -reset_typo_tolerance_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' typo_tolerance_guide_1: |- curl \ -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/typo-tolerance' \ @@ -860,11 +1326,11 @@ updating_guide_reset_displayed_attributes_old_authorization_header: |- curl \ -X DELETE 'http:///indexes/{index_uid}/settings/displayed-attributes' \ -H 'X-Meili-API-Key: API_KEY' + updating_guide_create_dump: |- curl \ -X POST 'http:///dumps' \ -H 'Authorization: Bearer API_KEY' - # -H 'X-Meili-API-Key: API_KEY' for v0.24 or below getting_started_typo_tolerance: |- curl \ -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/typo-tolerance' \ @@ -872,36 +1338,6 @@ getting_started_typo_tolerance: |- --data-binary '{ "minWordSizeForTypos": { "oneTypo": 4 } }' -get_pagination_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/books/settings/pagination' -update_pagination_settings_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/indexes/books/settings/pagination' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "maxTotalHits": 100 - }' -reset_pagination_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/books/settings/pagination' -get_faceting_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/books/settings/faceting' -update_faceting_settings_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/indexes/books/settings/faceting' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "maxValuesPerFacet": 2, - "sortFacetValuesBy": { - "*": "alpha", - "genres": "count" - } - }' -reset_faceting_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/books/settings/faceting' synonyms_guide_1: |- curl \ -X PUT 'MEILISEARCH_URL/indexes/movies/settings/synonyms' \ @@ -994,52 +1430,6 @@ async_guide_filter_by_statuses_2: |- async_guide_multiple_filters_1: |- curl \ -X GET 'MEILISEARCH_URL/tasks?indexUids=movies&types=documentAdditionOrUpdate,documentDeletion&statuses=processing' -delete_tasks_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/tasks?uids=1,2' -cancel_tasks_1: |- - curl \ - -X POST 'MEILISEARCH_URL/tasks/cancel?uids=1,2' -swap_indexes_1: |- - curl \ - -X POST 'MEILISEARCH_URL/swap-indexes' \ - -H 'Content-Type: application/json' \ - --data-binary '[ - { - "indexes": [ - "indexA", - "indexB" - ] - }, - { - "indexes": [ - "indexX", - "indexY" - ] - } - ]' -multi_search_1: |- - curl \ - -X POST 'MEILISEARCH_URL/multi-search' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "queries": [ - { - "indexUid": "movies", - "q": "pooh", - "limit": 5 - }, - { - "indexUid": "movies", - "q": "nemo", - "limit": 5 - }, - { - "indexUid": "movie_ratings", - "q": "us" - } - ] - }' multi_search_federated_1: |- curl \ -X POST 'MEILISEARCH_URL/multi-search' \ @@ -1072,61 +1462,26 @@ faceted_search_1: |- "q": "classic", "facets": [ "genres", "rating", "language" - ] - }' -search_parameter_guide_facet_stats_1: |- - curl \ - -X POST 'MEILISEARCH_URL/indexes/movie_ratings/search' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "q": "Batman", - "facets": ["genres", "rating"] - }' -filtering_update_settings_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/movie_ratings/settings/filterable-attributes' \ - -H 'Content-Type: application/json' \ - --data-binary '[ - "genres", - "director", - "release_date", - "ratings" - ]' -get_documents_post_1: |- - curl \ - -X POST MEILISEARCH_URL/indexes/books/documents/fetch \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "filter": "(rating > 3 AND (genres = Adventure OR genres = Fiction)) AND language = English", - "fields": ["title", "genres", "rating", "language"], - "limit": 3 - }' -delete_documents_by_filter_1: |- - curl \ - -X POST MEILISEARCH_URL/indexes/movies/documents/delete \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "filter": "genres = action OR genres = adventure" - }' -get_experimental_features_1: |- - curl \ - -X GET 'MEILISEARCH_URL/experimental-features/' -update_experimental_features_1: |- + ] + }' +search_parameter_guide_facet_stats_1: |- curl \ - -X PATCH 'MEILISEARCH_URL/experimental-features/' \ - -H 'Content-Type: application/json' \ + -X POST 'MEILISEARCH_URL/indexes/movie_ratings/search' \ + -H 'Content-Type: application/json' \ --data-binary '{ - "metrics": true + "q": "Batman", + "facets": ["genres", "rating"] }' -facet_search_1: |- +filtering_update_settings_1: |- curl \ - -X POST 'MEILISEARCH_URL/indexes/books/facet-search' \ + -X PUT 'MEILISEARCH_URL/indexes/movie_ratings/settings/filterable-attributes' \ -H 'Content-Type: application/json' \ - --data-binary '{ - "facetQuery": "fiction", - "facetName": "genres", - "filter": "rating > 3" - }' + --data-binary '[ + "genres", + "director", + "release_date", + "ratings" + ]' facet_search_2: |- curl \ -X PATCH 'MEILISEARCH_URL/indexes/books/settings/faceting' \ @@ -1160,7 +1515,6 @@ search_parameter_guide_show_ranking_score_details_1: |- "q": "dragon", "showRankingScoreDetails": true }' - search_parameter_guide_attributes_to_search_on_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/movies/search' \ @@ -1169,78 +1523,6 @@ search_parameter_guide_attributes_to_search_on_1: |- "q": "adventure", "attributesToSearchOn": ["overview"] }' -get_separator_tokens_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/articles/settings/separator-tokens' -update_separator_tokens_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/articles/settings/separator-tokens' \ - -H 'Content-Type: application/json' \ - --data-binary '["|", "…"]' -reset_separator_tokens_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/articles/settings/separator-tokens' -get_non_separator_tokens_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/articles/settings/non-separator-tokens' -update_non_separator_tokens_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/articles/settings/non-separator-tokens' \ - -H 'Content-Type: application/json' \ - --data-binary '["@", "#"]' -reset_non_separator_tokens_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/articles/settings/non-separator-tokens' -get_dictionary_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/books/settings/dictionary' -update_dictionary_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/books/settings/dictionary' \ - -H 'Content-Type: application/json' \ - --data-binary '[ - "J. R. R.", - "W. E. B." - ]' -reset_dictionary_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/books/settings/dictionary' -create_snapshot_1: |- - curl \ - -X POST 'MEILISEARCH_URL/snapshots' -get_proximity_precision_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/books/settings/proximity-precision' -update_proximity_precision_settings_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/books/settings/proximity-precision' \ - -H 'Content-Type: application/json' \ - --data-binary '"byAttribute"' -reset_proximity_precision_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/books/settings/proximity-precision' -get_facet_search_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/facet-search' -update_facet_search_settings_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/INDEX_UID/settings/facet-search' \ - -H 'Content-Type: application/json' \ - --data-binary 'false' -reset_facet_search_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/facet-search' -get_prefix_search_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' -update_prefix_search_settings_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' \ - -H 'Content-Type: application/json' \ - --data-binary '"disabled"' -reset_prefix_search_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' index_settings_tutorial_api_get_setting_1: |- curl \ -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/searchable-attributes' @@ -1255,17 +1537,6 @@ index_settings_tutorial_api_put_setting_1: |- index_settings_tutorial_api_task_1: |- curl \ -X GET 'MEILISEARCH_URL/tasks/TASK_UID' -get_search_cutoff_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/movies/settings/search-cutoff-ms' -update_search_cutoff_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/movies/settings/search-cutoff-ms' \ - -H 'Content-Type: application/json' \ - --data-binary '150' -reset_search_cutoff_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/movies/settings/search-cutoff-ms' negative_search_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/movies/search' \ @@ -1379,55 +1650,6 @@ search_parameter_reference_locales_1: |- "q": "QUERY TEXT IN JAPANESE", "locales": ["jpn"] }' -get_localized_attribute_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/localized-attributes' -update_localized_attribute_settings_1: |- - curl \ - -X PUT 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/localized-attributes' \ - -H 'Content-Type: application/json' \ - --data-binary '[ - {"locales": ["jpn"], "attributePatterns": ["*_ja"]} - ]' -reset_localized_attribute_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/localized-attributes' -get_all_batches_1: |- - curl \ - -X GET 'http://MEILISEARCH_URL/batches' -get_batch_1: |- - curl \ - -X GET 'http://MEILISEARCH_URL/batches/BATCH_UID' -get_similar_post_1: |- - curl \ - -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/similar' \ - -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \ - --data-binary '{ - "id": TARGET_DOCUMENT_ID, - "embedder": "EMBEDDER_NAME" - }' -get_similar_get_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/similar?id=TARGET_DOCUMENT_ID&embedder=EMBEDDER_NAME' -get_embedders_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/embedders' -update_embedders_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/embedders' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "default": { - "source": "openAi", - "apiKey": "OPEN_AI_API_KEY", - "model": "text-embedding-3-small", - "documentTemplate": "A document titled '{{doc.title}}' whose description starts with {{doc.overview|truncatewords: 20}}" - } - }' -reset_embedders_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/embedders' search_parameter_guide_hybrid_1: |- curl -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \ -H 'content-type: application/json' \ @@ -1441,7 +1663,7 @@ search_parameter_guide_hybrid_1: |- search_parameter_guide_vector_1: |- curl -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \ -H 'content-type: application/json' \ - --data-binary '{ + --data-binary '{ "vector": [0, 1, 2], "hybrid": { "embedder": "EMBEDDER_NAME" @@ -1458,9 +1680,9 @@ search_parameter_reference_retrieve_vectors_1: |- } }' related_results_embedder_1: |- - curl -X PATCH 'MEILISEARCH_URL/indexes/movies/settings' - -H 'Content-Type: application/json' - -H 'Authorization: Bearer MEILISEARCH_API_KEY' + curl -X PATCH 'MEILISEARCH_URL/indexes/movies/settings' + -H 'Content-Type: application/json' + -H 'Authorization: Bearer MEILISEARCH_API_KEY' --data-binary '{ "embedders": { "movies-text": { @@ -1490,78 +1712,12 @@ related_results_similar_1: |- "id": 192, "embedder": "EMBEDDER_NAME" }' -export_post_1: |- - curl \ - -X POST 'MEILISEARCH_URL/export' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "url": "TARGET_INSTANCE_URL", - "indexes": { - "*": { - "overrideSettings": true - } - } - }' -webhooks_get_1: |- - curl \ - -X GET 'MEILISEARCH_URL/webhooks' -webhooks_get_single_1: |- - curl \ - -X GET 'MEILISEARCH_URL/webhooks/WEBHOOK_UUID' -webhooks_post_1: |- - curl \ - -X POST 'MEILISEARCH_URL/webhooks' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "url": "WEBHOOK_TARGET_URL", - "headers": { - "authorization": "SECURITY_KEY", - "referer": "https://example.com" - } - }' -webhooks_patch_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/webhooks/WEBHOOK_UUID' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "header": { - "referer": null - } - }' -webhooks_delete_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/webhooks/WEBHOOK_UUID' rename_an_index_1: |- curl \ -X PATCH 'MEILISEARCH_URL/indexes/INDEX_A' \ -H 'Content-Type: application/json' \ --data-binary '{ "uid": "INDEX_B" }' -compact_index_1: |- - curl \ - -X POST 'MEILISEARCH_URL/indexes/INDEX_UID/compact' -### Code samples for experimental features -experimental_get_metrics_1: |- - curl \ - -X GET 'MEILISEARCH_URL/metrics' -experimental_post_logs_stderr_1: |- - curl \ - -X POST MEILISEARCH_URL/logs/stderr \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "target": "milli=trace,index_scheduler=info,actix_web=off" - }' -experimental_post_logs_stream_1: |- - curl \ - -X POST MEILISEARCH_URL/logs/stream \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "mode": "human", - "target": "index_scheduler=trace" - }' -experimental_delete_logs_stream_1: |- - curl \ - -X DELETE MEILISEARCH_URL/logs/stream multi_search_remote_federated_1: |- curl \ -X POST 'MEILISEARCH_URL/multi-search' \ @@ -1584,27 +1740,7 @@ multi_search_remote_federated_1: |- } } ] - }' -get_network_1: |- - curl \ - -X GET 'MEILISEARCH_URL/network' -update_network_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/network' \ - -H 'Content-Type: application/json' \ - --data-binary '{ - "self": "ms-00", - "remotes": { - "ms-00": { - "url": "http://INSTANCE_URL", - "searchApiKey": "INSTANCE_API_KEY" - }, - "ms-01": { - "url": "http://ANOTHER_INSTANCE_URL", - "searchApiKey": "ANOTHER_INSTANCE_API_KEY" - } - } - }' + search_parameter_reference_media_1: |- curl \ -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \ @@ -1621,14 +1757,3 @@ search_parameter_reference_media_1: |- } } }' -get_vector_store_settings_1: |- - curl \ - -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/vector-store' -update_vector_store_settings_1: |- - curl \ - -X PATCH 'MEILISEARCH_URL/indexes/INDEX_UID/settings/vector-store' \ - -H 'Content-Type: application/json' \ - --data-binary '"experimental"' -reset_vector_store_settings_1: |- - curl \ - -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/vector-store' diff --git a/snippets/samples/code_samples_add_or_update_documents_1.mdx b/snippets/samples/code_samples_add_or_update_documents_1.mdx index 53a1dd526..c2d99d8e1 100644 --- a/snippets/samples/code_samples_add_or_update_documents_1.mdx +++ b/snippets/samples/code_samples_add_or_update_documents_1.mdx @@ -82,7 +82,8 @@ await index.UpdateDocumentsAsync(movie); #[derive(Serialize, Deserialize)] struct IncompleteMovie { id: usize, - title: String + title: String, + genres: String } let task: TaskInfo = client @@ -90,7 +91,8 @@ let task: TaskInfo = client .add_or_update(&[ IncompleteMovie { id: 287947, - title: "Shazam ⚡️".to_string() + title: "Shazam ⚡️".to_string(), + genres: "comedy".to_string() } ], None) .await diff --git a/snippets/samples/code_samples_typo_tolerance_guide_2.mdx b/snippets/samples/code_samples_typo_tolerance_guide_2.mdx index 1150ed453..29c49b90c 100644 --- a/snippets/samples/code_samples_typo_tolerance_guide_2.mdx +++ b/snippets/samples/code_samples_typo_tolerance_guide_2.mdx @@ -59,7 +59,6 @@ let typo_tolerance = TypoToleranceSettings { disable_on_words: None, min_word_size_for_typos: None, }; - let task: TaskInfo = client .index("movies") .set_typo_tolerance(&typo_tolerance) diff --git a/snippets/samples/code_samples_typo_tolerance_guide_5.mdx b/snippets/samples/code_samples_typo_tolerance_guide_5.mdx index be212b7fd..8e0cc3c55 100644 --- a/snippets/samples/code_samples_typo_tolerance_guide_5.mdx +++ b/snippets/samples/code_samples_typo_tolerance_guide_5.mdx @@ -42,4 +42,18 @@ client.Index("movies").UpdateTypoTolerance(&meilisearch.TypoTolerance{ DisableOnNumbers: true }) ``` + +```rust Rust +// Deactivate typo tolerance on numbers and other high entropy words +let typo_tolerance = TypoToleranceSettings { + disable_on_numbers: Some(true), + ..Default::default() +}; + +let task: TaskInfo = client + .index("movies") + .set_typo_tolerance(&typo_tolerance) + .await + .unwrap(); +``` \ No newline at end of file