From 79c63049d7fb67ebf8a85da97946232aabe4e25c Mon Sep 17 00:00:00 2001 From: tamo Date: Mon, 29 Mar 2021 20:19:37 +0200 Subject: [PATCH] update the settings routes --- meilisearch-http/src/index/updates.rs | 3 +++ meilisearch-http/src/routes/settings/mod.rs | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/index/updates.rs b/meilisearch-http/src/index/updates.rs index a519eaa82..79558dd92 100644 --- a/meilisearch-http/src/index/updates.rs +++ b/meilisearch-http/src/index/updates.rs @@ -43,6 +43,9 @@ pub struct Settings { skip_serializing_if = "Option::is_none" )] pub ranking_rules: Option>>, + + // TODO we are missing the stopWords, synonyms and distinctAttribute for the GET settings + // request } impl Settings { diff --git a/meilisearch-http/src/routes/settings/mod.rs b/meilisearch-http/src/routes/settings/mod.rs index ee9b3e325..b5989bf87 100644 --- a/meilisearch-http/src/routes/settings/mod.rs +++ b/meilisearch-http/src/routes/settings/mod.rs @@ -131,7 +131,9 @@ async fn update_all( .update_settings(index_uid.into_inner(), body.into_inner(), true) .await { - Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)), + Ok(update_result) => { + Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_result.id() }))) + } Err(e) => { Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() }))) } @@ -161,7 +163,9 @@ async fn delete_all( .update_settings(index_uid.into_inner(), settings, false) .await { - Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)), + Ok(update_result) => { + Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_result.id() }))) + } Err(e) => { Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() }))) }