@@ -174,32 +174,22 @@ pub(crate) async fn async_sleep(interval: Duration) {
174174}
175175
176176#[ derive( Debug , Clone , Deserialize ) ]
177- pub enum RankingRule {
178- Words ,
179- Typo ,
180- Proximity ,
181- Attribute ,
182- Exactness ,
183- Asc ( String ) ,
184- Desc ( String ) ,
185- }
186-
187- #[ derive( Debug , Clone , Deserialize ) ]
188- pub enum UpdateState < T > {
189- Update ( T ) ,
190- Clear ,
191- Nothing ,
192- }
193-
194- #[ derive( Debug , Clone , Deserialize ) ]
177+ #[ serde( rename_all = "camelCase" ) ]
195178pub struct SettingsUpdate {
196- pub ranking_rules : UpdateState < Vec < RankingRule > > ,
197- pub distinct_attribute : UpdateState < String > ,
198- pub searchable_attributes : UpdateState < Vec < String > > ,
199- pub displayed_attributes : UpdateState < BTreeSet < String > > ,
200- pub stop_words : UpdateState < BTreeSet < String > > ,
201- pub synonyms : UpdateState < BTreeMap < String , Vec < String > > > ,
202- pub filterable_attributes : UpdateState < Vec < String > > ,
179+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
180+ pub ranking_rules : Option < Vec < String > > ,
181+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
182+ pub distinct_attribute : Option < String > ,
183+ #[ serde( skip_serializing_if = "Vec::is_none" ) ]
184+ pub searchable_attributes : Option < Vec < String > > ,
185+ #[ serde( skip_serializing_if = "BTreeSet::is_not_set" ) ]
186+ pub displayed_attributes : Option < BTreeSet < String > > ,
187+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
188+ pub stop_words : Option < BTreeSet < String > > ,
189+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
190+ pub synonyms : Option < BTreeMap < String , Vec < String > > > ,
191+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
192+ pub filterable_attributes : Option < Vec < String > > ,
203193}
204194
205195#[ allow( clippy:: large_enum_variant) ]
0 commit comments