diff --git a/meilisearch-core/src/serde/indexer.rs b/meilisearch-core/src/serde/indexer.rs index 68066069f..62ee28248 100644 --- a/meilisearch-core/src/serde/indexer.rs +++ b/meilisearch-core/src/serde/indexer.rs @@ -24,9 +24,7 @@ impl<'a> ser::Serializer for Indexer<'a> { type SerializeStructVariant = ser::Impossible; fn serialize_bool(self, _value: bool) -> Result { - Err(SerializerError::UnindexableType { - type_name: "boolean", - }) + Ok(None) } fn serialize_char(self, value: char) -> Result { @@ -96,9 +94,7 @@ impl<'a> ser::Serializer for Indexer<'a> { } fn serialize_none(self) -> Result { - Err(SerializerError::UnindexableType { - type_name: "Option", - }) + Ok(None) } fn serialize_some(self, value: &T) -> Result @@ -113,13 +109,11 @@ impl<'a> ser::Serializer for Indexer<'a> { } fn serialize_unit(self) -> Result { - Err(SerializerError::UnindexableType { type_name: "()" }) + Ok(None) } fn serialize_unit_struct(self, _name: &'static str) -> Result { - Err(SerializerError::UnindexableType { - type_name: "unit struct", - }) + Ok(None) } fn serialize_unit_variant( @@ -128,9 +122,7 @@ impl<'a> ser::Serializer for Indexer<'a> { _variant_index: u32, _variant: &'static str, ) -> Result { - Err(SerializerError::UnindexableType { - type_name: "unit variant", - }) + Ok(None) } fn serialize_newtype_struct( @@ -219,9 +211,14 @@ impl<'a> ser::Serializer for Indexer<'a> { _name: &'static str, _len: usize, ) -> Result { - Err(SerializerError::UnindexableType { - type_name: "struct", - }) + let indexer = StructIndexer { + attribute: self.attribute, + document_id: self.document_id, + indexer: self.indexer, + texts: Vec::new(), + }; + + Ok(indexer) } fn serialize_struct_variant(