From 1d8dfafd25b254eab564c28b373a03c08ef3b879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 27 Jun 2023 14:54:49 +0200 Subject: [PATCH] Add analytics when all facets are sorted by count and the number of modified ones --- meilisearch/src/routes/indexes/settings.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meilisearch/src/routes/indexes/settings.rs b/meilisearch/src/routes/indexes/settings.rs index 7035093eb..fb5d8ff7a 100644 --- a/meilisearch/src/routes/indexes/settings.rs +++ b/meilisearch/src/routes/indexes/settings.rs @@ -401,13 +401,17 @@ make_setting_route!( analytics, |setting: &Option, req: &HttpRequest| { use serde_json::json; + use meilisearch_types::facet_values_sort::FacetValuesSort; analytics.publish( "Faceting Updated".to_string(), json!({ "faceting": { "max_values_per_facet": setting.as_ref().and_then(|s| s.max_values_per_facet.set()), - "sort_facet_values_by": setting.as_ref().and_then(|s| s.sort_facet_values_by.clone().set()), + "sort_facet_values_by_star_count": setting.as_ref().and_then(|s| { + s.sort_facet_values_by.as_ref().set().map(|s| s.iter().any(|(k, v)| k == "*" && v == &FacetValuesSort::Count)) + }), + "sort_facet_values_by_total": setting.as_ref().and_then(|s| s.sort_facet_values_by.as_ref().set().map(|s| s.len())), }, }), Some(req),