From bb40ce6e35b5e6a13eaf7600b32d2e94e55cb2d7 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Mon, 10 Jul 2023 08:48:04 +0200 Subject: [PATCH] Experimental features analytics match the spec --- meilisearch/src/routes/features.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/meilisearch/src/routes/features.rs b/meilisearch/src/routes/features.rs index de5becfd1..a2822b4d4 100644 --- a/meilisearch/src/routes/features.rs +++ b/meilisearch/src/routes/features.rs @@ -64,7 +64,20 @@ async fn patch_features( vector_store: new_features.0.vector_store.unwrap_or(old_features.vector_store), }; - analytics.publish("Experimental features Updated".to_string(), json!(new_features), Some(&req)); + // explicitly destructure for analytics rather than using the `Serialize` implementation, because + // the it renames to camelCase, which we don't want for analytics. + // **Do not** ignore fields with `..` or `_` here, because we want to add them in the future. + let meilisearch_types::features::RuntimeTogglableFeatures { score_details, vector_store } = + new_features; + + analytics.publish( + "Experimental features Updated".to_string(), + json!({ + "score_details": score_details, + "vector_store": vector_store, + }), + Some(&req), + ); index_scheduler.put_runtime_features(new_features)?; Ok(HttpResponse::Ok().json(new_features)) }