Skip to content

Commit

Permalink
Merge #544
Browse files Browse the repository at this point in the history
544: Changes related to the next Meilisearch release (v1.7.0) r=curquiza a=meili-bot

Related to this issue: meilisearch/integration-guides#296

This PR:
- gathers the changes related to the next Meilisearch release (v1.7.0) so that this package is ready when the official release is out.
- should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases).
- might eventually contain test failures until the Meilisearch v1.7.0 is out.

⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.7.0) is out.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._


Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Co-authored-by: curquiza <clementine@meilisearch.com>
Co-authored-by: Clémentine U. - curqui <clementine@meilisearch.com>
  • Loading branch information
3 people authored Mar 11, 2024
2 parents 3d177b6 + 9d86c7c commit 7c7f428
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
1 change: 0 additions & 1 deletion .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,6 @@ get_experimental_features_1: |-
update_experimental_features_1: |-
let client = Client::new("http://localhost:7700", Some("apiKey"));
let mut features = ExperimentalFeatures::new(&client);
features.set_score_details(true);
features.set_vector_store(true);
let res = features
.update()
Expand Down
25 changes: 2 additions & 23 deletions src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExperimentalFeaturesResult {
pub score_details: bool,
pub vector_store: bool,
}

Expand All @@ -24,16 +23,14 @@ pub struct ExperimentalFeaturesResult {
/// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
/// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY));
/// let mut features = ExperimentalFeatures::new(&client);
/// features.set_score_details(true);
/// features.set_vector_store(true);
/// ```
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExperimentalFeatures<'a> {
#[serde(skip_serializing)]
client: &'a Client,
#[serde(skip_serializing_if = "Option::is_none")]
pub score_details: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub vector_store: Option<bool>,
}

Expand All @@ -42,16 +39,10 @@ impl<'a> ExperimentalFeatures<'a> {
pub fn new(client: &'a Client) -> Self {
ExperimentalFeatures {
client,
score_details: None,
vector_store: None,
}
}

pub fn set_score_details(&mut self, score_details: bool) -> &mut Self {
self.score_details = Some(score_details);
self
}

pub fn set_vector_store(&mut self, vector_store: bool) -> &mut Self {
self.vector_store = Some(vector_store);
self
Expand Down Expand Up @@ -92,7 +83,7 @@ impl<'a> ExperimentalFeatures<'a> {
/// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY));
/// futures::executor::block_on(async move {
/// let mut features = ExperimentalFeatures::new(&client);
/// features.set_score_details(true);
/// features.set_vector_store(true);
/// features.update().await.unwrap();
/// });
/// ```
Expand All @@ -118,26 +109,14 @@ mod tests {
#[meilisearch_test]
async fn test_experimental_features_get(client: Client) {
let mut features = ExperimentalFeatures::new(&client);
features.set_score_details(false);
features.set_vector_store(false);
let _ = features.update().await.unwrap();

let res = features.get().await.unwrap();

assert!(!res.score_details);
assert!(!res.vector_store);
}

#[meilisearch_test]
async fn test_experimental_features_enable_score_details(client: Client) {
let mut features = ExperimentalFeatures::new(&client);
features.set_score_details(true);

let res = features.update().await.unwrap();

assert!(res.score_details);
}

#[meilisearch_test]
async fn test_experimental_features_enable_vector_store(client: Client) {
let mut features = ExperimentalFeatures::new(&client);
Expand Down

0 comments on commit 7c7f428

Please sign in to comment.