@@ -123,17 +123,6 @@ pub struct SearchResults<T> {
123123 pub index_uid : Option < String > ,
124124}
125125
126- pub ( crate ) fn serialize_with_wildcard < S : Serializer , T : Serialize > (
127- data : & Option < Selectors < T > > ,
128- s : S ,
129- ) -> Result < S :: Ok , S :: Error > {
130- match data {
131- Some ( Selectors :: All ) => [ "*" ] . serialize ( s) ,
132- Some ( Selectors :: Some ( data) ) => data. serialize ( s) ,
133- None => s. serialize_none ( ) ,
134- }
135- }
136-
137126fn serialize_attributes_to_crop_with_wildcard < S : Serializer > (
138127 data : & Option < Selectors < & [ AttributeToCrop ] > > ,
139128 s : S ,
@@ -169,6 +158,15 @@ pub enum Selectors<T> {
169158 All ,
170159}
171160
161+ impl Serialize for Selectors < & [ & str ] > {
162+ fn serialize < S : Serializer > ( & self , s : S ) -> Result < S :: Ok , S :: Error > {
163+ match self {
164+ Selectors :: Some ( data) => data. serialize ( s) ,
165+ Selectors :: All => [ "*" ] . serialize ( s) ,
166+ }
167+ }
168+ }
169+
172170/// Configures Meilisearch to return search results based on a query’s meaning and context
173171#[ derive( Debug , Serialize , Clone ) ]
174172#[ serde( rename_all = "camelCase" ) ]
@@ -291,7 +289,6 @@ pub struct SearchQuery<'a, Http: HttpClient> {
291289 ///
292290 /// **Default: all attributes found in the documents.**
293291 #[ serde( skip_serializing_if = "Option::is_none" ) ]
294- #[ serde( serialize_with = "serialize_with_wildcard" ) ]
295292 pub facets : Option < Selectors < & ' a [ & ' a str ] > > ,
296293 /// Attributes to sort.
297294 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -309,7 +306,6 @@ pub struct SearchQuery<'a, Http: HttpClient> {
309306 ///
310307 /// **Default: all attributes found in the documents.**
311308 #[ serde( skip_serializing_if = "Option::is_none" ) ]
312- #[ serde( serialize_with = "serialize_with_wildcard" ) ]
313309 pub attributes_to_retrieve : Option < Selectors < & ' a [ & ' a str ] > > ,
314310 /// Attributes whose values have to be cropped.
315311 ///
@@ -337,7 +333,6 @@ pub struct SearchQuery<'a, Http: HttpClient> {
337333 ///
338334 /// Can be set to a [wildcard value](enum.Selectors.html#variant.All) that will select all existing attributes.
339335 #[ serde( skip_serializing_if = "Option::is_none" ) ]
340- #[ serde( serialize_with = "serialize_with_wildcard" ) ]
341336 pub attributes_to_highlight : Option < Selectors < & ' a [ & ' a str ] > > ,
342337 /// Tag in front of a highlighted term.
343338 ///
0 commit comments