mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
fix all the single settings route and add the searchable attributes Updated event
This commit is contained in:
parent
fc2f23d36c
commit
6ef73eb226
@ -99,8 +99,10 @@ make_setting_route!(
|
|||||||
analytics.publish(
|
analytics.publish(
|
||||||
"FilterableAttributes Updated".to_string(),
|
"FilterableAttributes Updated".to_string(),
|
||||||
json!({
|
json!({
|
||||||
|
"filterable_attributes": {
|
||||||
"total": setting.as_ref().map(|filter| filter.len()).unwrap_or(0),
|
"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,8 +121,10 @@ make_setting_route!(
|
|||||||
analytics.publish(
|
analytics.publish(
|
||||||
"SortableAttributes Updated".to_string(),
|
"SortableAttributes Updated".to_string(),
|
||||||
json!({
|
json!({
|
||||||
|
"sortable_attributes": {
|
||||||
"total": setting.as_ref().map(|sort| sort.len()).unwrap_or(0),
|
"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),
|
||||||
);
|
);
|
||||||
@ -138,7 +142,21 @@ make_setting_route!(
|
|||||||
"/searchable-attributes",
|
"/searchable-attributes",
|
||||||
Vec<String>,
|
Vec<String>,
|
||||||
searchable_attributes,
|
searchable_attributes,
|
||||||
"searchableAttributes"
|
"searchableAttributes",
|
||||||
|
analytics,
|
||||||
|
|setting: &Option<Vec<String>>, req: &HttpRequest| {
|
||||||
|
use serde_json::json;
|
||||||
|
|
||||||
|
analytics.publish(
|
||||||
|
"SearchableAttributes Updated".to_string(),
|
||||||
|
json!({
|
||||||
|
"searchable_attributes": {
|
||||||
|
"total": setting.as_ref().map(|sort| sort.len()).unwrap_or(0),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
Some(req),
|
||||||
|
);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
make_setting_route!(
|
make_setting_route!(
|
||||||
|
Loading…
Reference in New Issue
Block a user