Skip to content

Commit 085ceb0

Browse files
Merge #523
523: Add code samples and remove useless ones r=curquiza a=curquiza I created [scripts to manage code samples](https://github.com/meilisearch/integration-automations/pull/164) (internal only) 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-rust - 'settings_guide_filterable_attributes_1' not found in documentation - 'settings_guide_typo_tolerance_1' not found in documentation - '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 ``` 2. I found the following code samples were missing: ```bash meilisearch-rust - 'search_parameter_guide_facet_stats_1' not found - 'facet_search_1' not found - 'facet_search_2' not found - 'facet_search_3' not found ``` However, only `search_parameter_guide_facet_stats_1`was added because of missing feature implementation for the others Co-authored-by: curquiza <[email protected]>
2 parents af55f36 + ef377e1 commit 085ceb0

File tree

1 file changed

+8
-92
lines changed

1 file changed

+8
-92
lines changed

.code-samples.meilisearch.yaml

Lines changed: 8 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -843,38 +843,6 @@ search_parameter_guide_hitsperpage_1: |-
843843
client.index("movies").search().with_hits_per_page(15).execute().await?;
844844
search_parameter_guide_page_1: |-
845845
client.index("movies").search().with_page(2).execute().await?;
846-
settings_guide_filterable_attributes_1: |-
847-
let settings = Settings::new()
848-
.with_filterable_attributes([
849-
"director",
850-
"genres"
851-
]);
852-
853-
let task: TaskInfo = client
854-
.index("movies")
855-
.set_settings(&settings)
856-
.await
857-
.unwrap();
858-
settings_guide_typo_tolerance_1: |-
859-
let min_word_size_for_typos = MinWordSizeForTypos {
860-
one_typo: Some(5),
861-
two_typos: Some(12)
862-
}
863-
let typo_tolerance = TypoToleranceSettings {
864-
enabled: Some(true),
865-
disable_on_attributes: None,
866-
disable_on_words: Some(vec!["title".to_string()]),
867-
min_word_size_for_typos: Some(min_word_size_for_typos),
868-
};
869-
870-
let settings = Settings::new()
871-
.with_typo_tolerance(&typo_tolerance);
872-
873-
let task: TaskInfo = client
874-
.index("movies")
875-
.set_settings(&settings)
876-
.await
877-
.unwrap();
878846
typo_tolerance_guide_1: |-
879847
let typo_tolerance = TypoToleranceSettings {
880848
enabled: Some(false),
@@ -970,25 +938,6 @@ add_movies_json_1: |-
970938
.await
971939
.unwrap();
972940
})}
973-
documents_guide_add_movie_1: |-
974-
// Define the type of our documents
975-
#[derive(Serialize, Deserialize)]
976-
struct IncompleteMovie {
977-
id: String,
978-
title: String
979-
}
980-
981-
// Add a document to our index
982-
let task: TaskInfo = client
983-
.index("movies")
984-
.add_documents(&[
985-
IncompleteMovie {
986-
id: "123sq178".to_string(),
987-
title: "Amélie Poulain".to_string(),
988-
}
989-
], None)
990-
.await
991-
.unwrap();
992941
primary_field_guide_update_document_primary_key: |-
993942
let task = IndexUpdater::new("books", &client)
994943
.with_primary_key("title")
@@ -1193,11 +1142,6 @@ getting_started_update_displayed_attributes: |-
11931142
.set_displayed_attributes(&displayed_attributes)
11941143
.await
11951144
.unwrap();
1196-
getting_started_communicating_with_a_protected_instance: |-
1197-
let client = Client::new("http://localhost:7700", Some("apiKey"));
1198-
client
1199-
.index("movies")
1200-
.search()
12011145
getting_started_add_meteorites: |-
12021146
use serde::{Serialize, Deserialize};
12031147
use std::fs::File;
@@ -1297,19 +1241,6 @@ filtering_update_settings_1: |-
12971241
.set_filterable_attributes(["director", "genres"])
12981242
.await
12991243
.unwrap();
1300-
faceted_search_facets_1: |-
1301-
let results: SearchResults<Movie> = client
1302-
.index("movies")
1303-
.search()
1304-
.with_query("Batman")
1305-
.with_facets(Selectors::Some(&["genres"]))
1306-
.execute()
1307-
.await
1308-
.unwrap();
1309-
let genres: &HashMap<String, usize> = results
1310-
.facet_distribution.unwrap()
1311-
.get("genres")
1312-
.unwrap();
13131244
faceted_search_walkthrough_filter_1: |-
13141245
let results: SearchResults<Movie> = client
13151246
.index("movies")
@@ -1334,29 +1265,6 @@ faceted_search_1: |-
13341265
.execute()
13351266
.await
13361267
.unwrap();
1337-
faceted_search_2: |-
1338-
let books = client.index("books");
1339-
let search_query_1 = SearchQuery::new(&books)
1340-
.with_facets(Selectors::Some(&["language", "genres", "author", "format"]))
1341-
.with_filter("(language = English OR language = French) AND genres = Fiction")
1342-
.build();
1343-
let search_query_2 = SearchQuery::new(&books)
1344-
.with_facets(Selectors::Some(&["language"]))
1345-
.with_filter("genres = Fiction")
1346-
.build();
1347-
let search_query_3 = SearchQuery::new(&books)
1348-
.with_facets(Selectors::Some(&["genres"]))
1349-
.with_filter("language = English OR language = French")
1350-
.build();
1351-
1352-
let books_response = client
1353-
.multi_search()
1354-
.with_search_query(search_query_1)
1355-
.with_search_query(search_query_2)
1356-
.with_search_query(search_query_3)
1357-
.execute::<Book>()
1358-
.await
1359-
.unwrap();
13601268
post_dump_1: |-
13611269
client
13621270
.create_dump()
@@ -1681,3 +1589,11 @@ update_experimental_features_1: |-
16811589
.update()
16821590
.await
16831591
.unwrap();
1592+
search_parameter_guide_facet_stats_1: |-
1593+
let books = client.index("movie_ratings");
1594+
let results: SearchResults<Book> = SearchQuery::new(&books)
1595+
.with_query("Batman")
1596+
.with_facets(Selectors::Some(&["genres", "rating"))
1597+
.execute()
1598+
.await
1599+
.unwrap();

0 commit comments

Comments
 (0)