pub trait Document: Send + Sync + 'static {
type Value<'a>: Value<'a> + Clone
where Self: 'a;
type FieldsValuesIter<'a>: Iterator<Item = (Field, Self::Value<'a>)>
where Self: 'a;
// Required method
fn iter_fields_and_values(&self) -> Self::FieldsValuesIter<'_>;
// Provided methods
fn get_sorted_field_values(&self) -> Vec<(Field, Vec<Self::Value<'_>>)> { ... }
fn to_named_doc(&self, schema: &Schema) -> NamedFieldDocument { ... }
fn to_json(&self, schema: &Schema) -> String { ... }
}
Expand description
The core trait representing a document within the index.
Required Associated Types§
sourcetype FieldsValuesIter<'a>: Iterator<Item = (Field, Self::Value<'a>)>
where
Self: 'a
type FieldsValuesIter<'a>: Iterator<Item = (Field, Self::Value<'a>)> where Self: 'a
The iterator over all of the fields and values within the doc.
Required Methods§
sourcefn iter_fields_and_values(&self) -> Self::FieldsValuesIter<'_>
fn iter_fields_and_values(&self) -> Self::FieldsValuesIter<'_>
Get an iterator iterating over all fields and values in a document.
Provided Methods§
sourcefn get_sorted_field_values(&self) -> Vec<(Field, Vec<Self::Value<'_>>)>
fn get_sorted_field_values(&self) -> Vec<(Field, Vec<Self::Value<'_>>)>
Sort and groups the field_values by field.
The result of this method is not cached and is computed on the fly when this method is called.
sourcefn to_named_doc(&self, schema: &Schema) -> NamedFieldDocument
fn to_named_doc(&self, schema: &Schema) -> NamedFieldDocument
Create a named document from the doc.
Object Safety§
This trait is not object safe.