From 37ca50832c79055ebe10d155fba58c13c86ebb71 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 27 Oct 2021 14:27:29 +0200 Subject: [PATCH] fix the sort position --- meilisearch-http/src/routes/indexes/settings.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meilisearch-http/src/routes/indexes/settings.rs b/meilisearch-http/src/routes/indexes/settings.rs index caf78d3fc..327752da6 100644 --- a/meilisearch-http/src/routes/indexes/settings.rs +++ b/meilisearch-http/src/routes/indexes/settings.rs @@ -172,12 +172,12 @@ make_setting_route!( use serde_json::json; analytics.publish( - "RankingRules Updated".to_string(), - json!({ - "sort_position": setting.as_ref().map(|sort| sort.iter().filter(|s| s.contains(':')).count()), - }), - Some(req), - ); + "RankingRules Updated".to_string(), + json!({ + "sort_position": setting.as_ref().map(|sort| sort.iter().position(|s| s == "sort")), + }), + Some(req), + ); } ); @@ -218,7 +218,7 @@ pub async fn update_all( "Settings Updated".to_string(), json!({ "ranking_rules": { - "sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().filter(|s| s.contains(':')).count()), + "sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().position(|s| s == "sort")), }, "sortable_attributes": { "total": settings.sortable_attributes.as_ref().set().map(|sort| sort.len()),