mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
Make sure that the order of the sortableAttributes is constant
This commit is contained in:
parent
64462c842b
commit
087e4626ce
@ -57,7 +57,7 @@ pub struct Settings<T> {
|
|||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||||
pub filterable_attributes: Setting<HashSet<String>>,
|
pub filterable_attributes: Setting<HashSet<String>>,
|
||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||||
pub sortable_attributes: Setting<HashSet<String>>,
|
pub sortable_attributes: Setting<BTreeSet<String>>,
|
||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||||
pub ranking_rules: Setting<Vec<String>>,
|
pub ranking_rules: Setting<Vec<String>>,
|
||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||||
@ -254,14 +254,19 @@ impl Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match settings.filterable_attributes {
|
match settings.filterable_attributes {
|
||||||
Setting::Set(ref facet_types) => builder.set_filterable_fields(facet_types.clone()),
|
Setting::Set(ref facets) => builder.set_filterable_fields(facets.clone()),
|
||||||
Setting::Reset => builder.set_filterable_fields(HashSet::new()),
|
Setting::Reset => builder.reset_filterable_fields(),
|
||||||
Setting::NotSet => (),
|
Setting::NotSet => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
match settings.sortable_attributes {
|
match settings.sortable_attributes {
|
||||||
Setting::Set(ref facet_types) => builder.set_sortable_fields(facet_types.clone()),
|
Setting::Set(ref fields) => {
|
||||||
Setting::Reset => builder.set_sortable_fields(HashSet::new()),
|
builder.set_sortable_fields(fields.iter().cloned().collect())
|
||||||
|
}
|
||||||
|
Setting::Reset => {
|
||||||
|
// TODO we must use the reset_sortable_fields in a futur PR.
|
||||||
|
builder.set_sortable_fields(HashSet::new())
|
||||||
|
}
|
||||||
Setting::NotSet => (),
|
Setting::NotSet => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ make_setting_route!(
|
|||||||
|
|
||||||
make_setting_route!(
|
make_setting_route!(
|
||||||
"/sortable-attributes",
|
"/sortable-attributes",
|
||||||
std::collections::HashSet<String>,
|
std::collections::BTreeSet<String>,
|
||||||
sortable_attributes,
|
sortable_attributes,
|
||||||
"sortableAttributes"
|
"sortableAttributes"
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user