diff --git a/meilidb-core/src/lib.rs b/meilidb-core/src/lib.rs index 838d787dd..e61fa543b 100644 --- a/meilidb-core/src/lib.rs +++ b/meilidb-core/src/lib.rs @@ -4,6 +4,7 @@ mod query_builder; mod store; pub mod criterion; +use std::fmt; use std::sync::Arc; use rayon::slice::ParallelSliceMut; @@ -210,6 +211,21 @@ impl RawDocument { } } +impl fmt::Debug for RawDocument { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("RawDocument") + .field("id", &self.id) + .field("query_index", &self.query_index()) + .field("distance", &self.distance()) + .field("attribute", &self.attribute()) + .field("word_index", &self.word_index()) + .field("is_exact", &self.is_exact()) + .field("char_index", &self.char_index()) + .field("char_length", &self.char_length()) + .finish() + } +} + pub fn raw_documents_from_matches(mut matches: Vec<(DocumentId, Match)>) -> Vec { let mut docs_ranges = Vec::<(DocumentId, Range)>::new(); let mut matches2 = Matches::with_capacity(matches.len());