@@ -1045,8 +1045,8 @@ primary_field_guide_add_document_primary_key: |-
1045
1045
], Some("reference_number"))
1046
1046
.await
1047
1047
.unwrap();
1048
- getting_started_add_documents_md : |-
1049
- ``` toml
1048
+ getting_started_add_documents : |-
1049
+ // In your . toml file:
1050
1050
[dependencies]
1051
1051
meilisearch-sdk = "0.28.0"
1052
1052
# futures: because we want to block on futures
@@ -1057,9 +1057,8 @@ getting_started_add_documents_md: |-
1057
1057
serde_json = "1.0"
1058
1058
```
1059
1059
1060
- Documents in the Rust library are strongly typed.
1061
-
1062
- ```rust
1060
+ // In your .rs file:
1061
+ // Documents in the Rust library are strongly typed
1063
1062
#[derive(Serialize, Deserialize)]
1064
1063
struct Movie {
1065
1064
id: i64,
@@ -1069,23 +1068,17 @@ getting_started_add_documents_md: |-
1069
1068
release_date: i64,
1070
1069
genres: Vec<String>
1071
1070
}
1072
- ```
1073
1071
1074
- You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
1075
- You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:
1076
-
1077
- ```rust
1072
+ // You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
1073
+ // You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:
1078
1074
#[derive(Serialize, Deserialize)]
1079
1075
struct Movie {
1080
1076
id: i64,
1081
1077
#[serde(flatten)]
1082
1078
value: serde_json::Value,
1083
1079
}
1084
- ```
1085
1080
1086
- Then, add documents into the index:
1087
-
1088
- ```rust
1081
+ // Then, add documents into the index:
1089
1082
use meilisearch_sdk::{
1090
1083
indexes::*,
1091
1084
client::*,
@@ -1099,7 +1092,7 @@ getting_started_add_documents_md: |-
1099
1092
fn main() { block_on(async move {
1100
1093
let client = Client::new("http://localhost:7700", Some("aSampleMasterKey"));
1101
1094
1102
- // reading and parsing the file
1095
+ // Reading and parsing the file
1103
1096
let mut file = File::open("movies.json")
1104
1097
.unwrap();
1105
1098
let mut content = String::new();
@@ -1109,19 +1102,15 @@ getting_started_add_documents_md: |-
1109
1102
let movies_docs: Vec<Movie> = serde_json::from_str(&content)
1110
1103
.unwrap();
1111
1104
1112
- // adding documents
1105
+ // Adding documents
1113
1106
client
1114
1107
.index("movies")
1115
1108
.add_documents(&movies_docs, None)
1116
1109
.await
1117
1110
.unwrap();
1118
1111
})}
1119
- ```
1120
-
1121
- [About this SDK](https://github.com/meilisearch/meilisearch-rust/)
1122
- getting_started_search_md : |-
1123
- You can build a `SearchQuery` and execute it later:
1124
- ```rust
1112
+ getting_started_search : |-
1113
+ // You can build a `SearchQuery` and execute it later:
1125
1114
let query: SearchQuery = SearchQuery::new(&movies)
1126
1115
.with_query("botman")
1127
1116
.build();
@@ -1131,29 +1120,22 @@ getting_started_search_md: |-
1131
1120
.execute_query(&query)
1132
1121
.await
1133
1122
.unwrap();
1134
- ```
1135
1123
1136
- You can build a `SearchQuery` and execute it directly:
1137
- ```rust
1124
+ // You can build a `SearchQuery` and execute it directly:
1138
1125
let results: SearchResults<Movie> = SearchQuery::new(&movies)
1139
1126
.with_query("botman")
1140
1127
.execute()
1141
1128
.await
1142
1129
.unwrap();
1143
- ```
1144
1130
1145
- You can search in an index directly:
1146
- ```rust
1131
+ // You can search in an index directly:
1147
1132
let results: SearchResults<Movie> = client
1148
1133
.index("movies")
1149
1134
.search()
1150
1135
.with_query("botman")
1151
1136
.execute()
1152
1137
.await
1153
1138
.unwrap();
1154
- ```
1155
-
1156
- [About this SDK](https://github.com/meilisearch/meilisearch-rust/)
1157
1139
getting_started_update_ranking_rules : |-
1158
1140
let ranking_rules = [
1159
1141
"exactness",
0 commit comments