diff --git a/meilisearch-http/src/index/updates.rs b/meilisearch-http/src/index/updates.rs index dd94f2cd2..b13e66efe 100644 --- a/meilisearch-http/src/index/updates.rs +++ b/meilisearch-http/src/index/updates.rs @@ -57,7 +57,7 @@ pub struct Settings { #[serde(default, skip_serializing_if = "Setting::is_not_set")] pub filterable_attributes: Setting>, #[serde(default, skip_serializing_if = "Setting::is_not_set")] - pub sortable_attributes: Setting>, + pub sortable_attributes: Setting>, #[serde(default, skip_serializing_if = "Setting::is_not_set")] pub ranking_rules: Setting>, #[serde(default, skip_serializing_if = "Setting::is_not_set")] @@ -254,14 +254,19 @@ impl Index { } match settings.filterable_attributes { - Setting::Set(ref facet_types) => builder.set_filterable_fields(facet_types.clone()), - Setting::Reset => builder.set_filterable_fields(HashSet::new()), + Setting::Set(ref facets) => builder.set_filterable_fields(facets.clone()), + Setting::Reset => builder.reset_filterable_fields(), Setting::NotSet => (), } match settings.sortable_attributes { - Setting::Set(ref facet_types) => builder.set_sortable_fields(facet_types.clone()), - Setting::Reset => builder.set_sortable_fields(HashSet::new()), + Setting::Set(ref fields) => { + 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 => (), } diff --git a/meilisearch-http/src/routes/indexes/settings.rs b/meilisearch-http/src/routes/indexes/settings.rs index a7ab2f7e0..b542d3260 100644 --- a/meilisearch-http/src/routes/indexes/settings.rs +++ b/meilisearch-http/src/routes/indexes/settings.rs @@ -82,7 +82,7 @@ make_setting_route!( make_setting_route!( "/sortable-attributes", - std::collections::HashSet, + std::collections::BTreeSet, sortable_attributes, "sortableAttributes" );