mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
default attributes_for_faceting to []
This commit is contained in:
parent
8f0d9ccd87
commit
ed051b65ad
@ -95,15 +95,17 @@ async fn get_all(
|
||||
|
||||
let attributes_for_faceting = match (&schema, &index.main.attributes_for_faceting(&reader)?) {
|
||||
(Some(schema), Some(attrs)) => {
|
||||
Some(attrs
|
||||
attrs
|
||||
.iter()
|
||||
.filter_map(|&id| schema.name(id))
|
||||
.map(str::to_string)
|
||||
.collect())
|
||||
.collect()
|
||||
}
|
||||
_ => None,
|
||||
_ => vec![],
|
||||
};
|
||||
|
||||
println!("{:?}", attributes_for_faceting);
|
||||
|
||||
let searchable_attributes = schema.clone().map(|s| {
|
||||
s.indexed_name()
|
||||
.iter()
|
||||
@ -128,7 +130,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),
|
||||
attributes_for_faceting: Some(Some(attributes_for_faceting)),
|
||||
};
|
||||
|
||||
Ok(HttpResponse::Ok().json(settings))
|
||||
@ -500,18 +502,18 @@ async fn get_attributes_for_faceting(
|
||||
|
||||
let attributes_for_faceting = data
|
||||
.db
|
||||
.main_read::<_, Option<Vec<String>>, ResponseError>(|reader| {
|
||||
.main_read::<_, _, ResponseError>(|reader| {
|
||||
let schema = index.main.schema(reader)?;
|
||||
let attrs = index.main.attributes_for_faceting(reader)?;
|
||||
let attr_names = match (&schema, &attrs) {
|
||||
(Some(schema), Some(attrs)) => {
|
||||
Some(attrs
|
||||
attrs
|
||||
.iter()
|
||||
.filter_map(|&id| schema.name(id))
|
||||
.map(str::to_string)
|
||||
.collect())
|
||||
.collect()
|
||||
}
|
||||
_ => None,
|
||||
_ => vec![]
|
||||
};
|
||||
Ok(attr_names)
|
||||
})?;
|
||||
|
Loading…
Reference in New Issue
Block a user