Add the faceting.max_values_per_facet setting

This commit is contained in:
Kerollmops 2022-06-08 17:08:10 +02:00
parent c924614527
commit 5450b5ced3
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
2 changed files with 56 additions and 0 deletions

View file

@ -282,6 +282,34 @@ make_setting_route!(
}
);
make_setting_route!(
"/faceting",
patch,
meilisearch_lib::index::updates::TypoSettings,
faceting,
"faceting",
analytics,
|setting: &Option<meilisearch_lib::index::updates::FacetingSettings>, req: &HttpRequest| {
use serde_json::json;
analytics.publish(
"Faceting Updated".to_string(),
json!({
"faceting": {
"max_values_per_facet": setting
.as_ref()
.and_then(|s| s.max_values_per_facet
.as_ref()
.set()
.map(|s| s.one_typo.set()))
.flatten(),
},
}),
Some(req),
);
}
);
macro_rules! generate_configure {
($($mod:ident),*) => {
pub fn configure(cfg: &mut web::ServiceConfig) {