mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
facet settings
This commit is contained in:
parent
59c67f6bc8
commit
270c7b0288
4 changed files with 54 additions and 1 deletions
|
@ -91,6 +91,17 @@ async fn get_all(
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let attributes_for_faceting = match (&schema, &index.main.attributes_for_faceting(&reader)?) {
|
||||
(Some(schema), Some(attrs)) => {
|
||||
Some(attrs
|
||||
.iter()
|
||||
.filter_map(|&id| schema .name(id))
|
||||
.map(str::to_string)
|
||||
.collect())
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let searchable_attributes = schema.clone().map(|s| {
|
||||
s.indexed_name()
|
||||
.iter()
|
||||
|
@ -115,6 +126,7 @@ async fn get_all(
|
|||
stop_words: Some(Some(stop_words)),
|
||||
synonyms: Some(Some(synonyms)),
|
||||
accept_new_fields: Some(accept_new_fields),
|
||||
attributes_for_faceting: Some(attributes_for_faceting),
|
||||
};
|
||||
|
||||
Ok(HttpResponse::Ok().json(settings))
|
||||
|
@ -140,6 +152,7 @@ async fn delete_all(
|
|||
stop_words: UpdateState::Clear,
|
||||
synonyms: UpdateState::Clear,
|
||||
accept_new_fields: UpdateState::Clear,
|
||||
attributes_for_faceting: UpdateState::Clear,
|
||||
};
|
||||
|
||||
let update_id = index.settings_update(&mut writer, settings)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue