Skip to content

Remove _md code samples for Mintlify migration #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 13 additions & 31 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,8 @@ primary_field_guide_add_document_primary_key: |-
], Some("reference_number"))
.await
.unwrap();
getting_started_add_documents_md: |-
```toml
getting_started_add_documents: |-
// In your .toml file:
[dependencies]
meilisearch-sdk = "0.28.0"
# futures: because we want to block on futures
Expand All @@ -1057,9 +1057,8 @@ getting_started_add_documents_md: |-
serde_json = "1.0"
```

Documents in the Rust library are strongly typed.

```rust
// In your .rs file:
// Documents in the Rust library are strongly typed
#[derive(Serialize, Deserialize)]
struct Movie {
id: i64,
Expand All @@ -1069,23 +1068,17 @@ getting_started_add_documents_md: |-
release_date: i64,
genres: Vec<String>
}
```

You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:

```rust
// You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
// You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:
#[derive(Serialize, Deserialize)]
struct Movie {
id: i64,
#[serde(flatten)]
value: serde_json::Value,
}
```

Then, add documents into the index:

```rust
// Then, add documents into the index:
use meilisearch_sdk::{
indexes::*,
client::*,
Expand All @@ -1099,7 +1092,7 @@ getting_started_add_documents_md: |-
fn main() { block_on(async move {
let client = Client::new("http://localhost:7700", Some("aSampleMasterKey"));

// reading and parsing the file
// Reading and parsing the file
let mut file = File::open("movies.json")
.unwrap();
let mut content = String::new();
Expand All @@ -1109,19 +1102,15 @@ getting_started_add_documents_md: |-
let movies_docs: Vec<Movie> = serde_json::from_str(&content)
.unwrap();

// adding documents
// Adding documents
client
.index("movies")
.add_documents(&movies_docs, None)
.await
.unwrap();
})}
```

[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
getting_started_search_md: |-
You can build a `SearchQuery` and execute it later:
```rust
getting_started_search: |-
// You can build a `SearchQuery` and execute it later:
let query: SearchQuery = SearchQuery::new(&movies)
.with_query("botman")
.build();
Expand All @@ -1131,29 +1120,22 @@ getting_started_search_md: |-
.execute_query(&query)
.await
.unwrap();
```

You can build a `SearchQuery` and execute it directly:
```rust
// You can build a `SearchQuery` and execute it directly:
let results: SearchResults<Movie> = SearchQuery::new(&movies)
.with_query("botman")
.execute()
.await
.unwrap();
```

You can search in an index directly:
```rust
// You can search in an index directly:
let results: SearchResults<Movie> = client
.index("movies")
.search()
.with_query("botman")
.execute()
.await
.unwrap();
```

[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
getting_started_update_ranking_rules: |-
let ranking_rules = [
"exactness",
Expand Down