From 94bd14ede3c85c176e1cb72e05e7913eaaa89ac2 Mon Sep 17 00:00:00 2001 From: mpostma Date: Mon, 15 Mar 2021 18:35:16 +0100 Subject: [PATCH] add name to index_metadata --- meilisearch-http/src/index_controller/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/meilisearch-http/src/index_controller/mod.rs b/meilisearch-http/src/index_controller/mod.rs index 0db60a41b..90c67e2b6 100644 --- a/meilisearch-http/src/index_controller/mod.rs +++ b/meilisearch-http/src/index_controller/mod.rs @@ -27,6 +27,7 @@ pub type UpdateStatus = updates::UpdateStatus; #[serde(rename_all = "camelCase")] pub struct IndexMetadata { uid: String, + name: String, #[serde(flatten)] meta: index_actor::IndexMeta, } @@ -176,7 +177,7 @@ impl IndexController { let uuid = self.uuid_resolver.create(uid.clone()).await?; let meta = self.index_handle.create_index(uuid, primary_key).await?; let _ = self.update_handle.create(uuid).await?; - let meta = IndexMetadata { uid, meta }; + let meta = IndexMetadata { name: uid.clone(), uid, meta }; Ok(meta) } @@ -207,7 +208,7 @@ impl IndexController { for (uid, uuid) in uuids { let meta = self.index_handle.get_index_meta(uuid).await?; - let meta = IndexMetadata { uid, meta }; + let meta = IndexMetadata { name: uid.clone(), uid, meta }; ret.push(meta); } @@ -260,7 +261,7 @@ impl IndexController { let uuid = self.uuid_resolver.resolve(uid.clone()).await?; let meta = self.index_handle.update_index(uuid, index_settings).await?; - let meta = IndexMetadata { uid, meta }; + let meta = IndexMetadata { name: uid.clone(), uid, meta }; Ok(meta) } @@ -273,7 +274,7 @@ impl IndexController { pub async fn get_index(&self, uid: String) -> anyhow::Result { let uuid = self.uuid_resolver.resolve(uid.clone()).await?; let meta = self.index_handle.get_index_meta(uuid).await?; - let meta = IndexMetadata { uid, meta }; + let meta = IndexMetadata { name: uid.clone(), uid, meta }; Ok(meta) } }