mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-30 23:13:09 +08:00
set the total of sortable attributes and filterable-attributes to 0 when not set
This commit is contained in:
parent
351ad32d77
commit
c5164c01c0
@ -99,7 +99,7 @@ make_setting_route!(
|
|||||||
analytics.publish(
|
analytics.publish(
|
||||||
"FilterableAttributes Updated".to_string(),
|
"FilterableAttributes Updated".to_string(),
|
||||||
json!({
|
json!({
|
||||||
"total": setting.as_ref().map(|filter| filter.len()),
|
"total": setting.as_ref().map(|filter| filter.len()).unwrap_or(0),
|
||||||
"has_geo": setting.as_ref().map(|filter| filter.contains("_geo")).unwrap_or(false),
|
"has_geo": setting.as_ref().map(|filter| filter.contains("_geo")).unwrap_or(false),
|
||||||
}),
|
}),
|
||||||
Some(req),
|
Some(req),
|
||||||
@ -119,7 +119,7 @@ make_setting_route!(
|
|||||||
analytics.publish(
|
analytics.publish(
|
||||||
"SortableAttributes Updated".to_string(),
|
"SortableAttributes Updated".to_string(),
|
||||||
json!({
|
json!({
|
||||||
"total": setting.as_ref().map(|sort| sort.len()),
|
"total": setting.as_ref().map(|sort| sort.len()).unwrap_or(0),
|
||||||
"has_geo": setting.as_ref().map(|sort| sort.contains("_geo")).unwrap_or(false),
|
"has_geo": setting.as_ref().map(|sort| sort.contains("_geo")).unwrap_or(false),
|
||||||
}),
|
}),
|
||||||
Some(req),
|
Some(req),
|
||||||
@ -221,11 +221,11 @@ pub async fn update_all(
|
|||||||
"sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().position(|s| s == "sort")),
|
"sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().position(|s| s == "sort")),
|
||||||
},
|
},
|
||||||
"sortable_attributes": {
|
"sortable_attributes": {
|
||||||
"total": settings.sortable_attributes.as_ref().set().map(|sort| sort.len()),
|
"total": settings.sortable_attributes.as_ref().set().map(|sort| sort.len()).unwrap_or(0),
|
||||||
"has_geo": settings.sortable_attributes.as_ref().set().map(|sort| sort.iter().any(|s| s == "_geo")).unwrap_or(false),
|
"has_geo": settings.sortable_attributes.as_ref().set().map(|sort| sort.iter().any(|s| s == "_geo")).unwrap_or(false),
|
||||||
},
|
},
|
||||||
"filterable_attributes": {
|
"filterable_attributes": {
|
||||||
"total": settings.filterable_attributes.as_ref().set().map(|filter| filter.len()),
|
"total": settings.filterable_attributes.as_ref().set().map(|filter| filter.len()).unwrap_or(0),
|
||||||
"has_geo": settings.filterable_attributes.as_ref().set().map(|filter| filter.iter().any(|s| s == "_geo")).unwrap_or(false),
|
"has_geo": settings.filterable_attributes.as_ref().set().map(|filter| filter.iter().any(|s| s == "_geo")).unwrap_or(false),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user