Make sure that the order of the filterableAttributes is constant

This commit is contained in:
Kerollmops 2021-08-25 10:17:33 +02:00
parent 087e4626ce
commit cf4a466b6b
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
2 changed files with 5 additions and 3 deletions

View File

@ -55,7 +55,7 @@ pub struct Settings<T> {
pub searchable_attributes: Setting<Vec<String>>, pub searchable_attributes: Setting<Vec<String>>,
#[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<BTreeSet<String>>,
#[serde(default, skip_serializing_if = "Setting::is_not_set")] #[serde(default, skip_serializing_if = "Setting::is_not_set")]
pub sortable_attributes: Setting<BTreeSet<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")]
@ -254,7 +254,9 @@ impl Index {
} }
match settings.filterable_attributes { match settings.filterable_attributes {
Setting::Set(ref facets) => builder.set_filterable_fields(facets.clone()), Setting::Set(ref facets) => {
builder.set_filterable_fields(facets.clone().into_iter().collect())
}
Setting::Reset => builder.reset_filterable_fields(), Setting::Reset => builder.reset_filterable_fields(),
Setting::NotSet => (), Setting::NotSet => (),
} }

View File

@ -75,7 +75,7 @@ macro_rules! make_setting_route {
make_setting_route!( make_setting_route!(
"/filterable-attributes", "/filterable-attributes",
std::collections::HashSet<String>, std::collections::BTreeSet<String>,
filterable_attributes, filterable_attributes,
"filterableAttributes" "filterableAttributes"
); );