mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 07:56:28 +00:00 
			
		
		
		
	Make sure that the order of the sortableAttributes is constant
This commit is contained in:
		| @@ -57,7 +57,7 @@ pub struct Settings<T> { | ||||
|     #[serde(default, skip_serializing_if = "Setting::is_not_set")] | ||||
|     pub filterable_attributes: Setting<HashSet<String>>, | ||||
|     #[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")] | ||||
|     pub ranking_rules: Setting<Vec<String>>, | ||||
|     #[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 => (), | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -82,7 +82,7 @@ make_setting_route!( | ||||
|  | ||||
| make_setting_route!( | ||||
|     "/sortable-attributes", | ||||
|     std::collections::HashSet<String>, | ||||
|     std::collections::BTreeSet<String>, | ||||
|     sortable_attributes, | ||||
|     "sortableAttributes" | ||||
| ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user