pub struct Document { /* private fields */ }
Expand description
Tantivy’s Document is the object that can be indexed and then searched for.
Documents are fundamentally a collection of unordered couples (field, value)
.
In this list, one field may appear more than once.
Implementations
sourceimpl Document
impl Document
sourcepub fn add_facet<F>(&mut self, field: Field, path: F)where
Facet: From<F>,
pub fn add_facet<F>(&mut self, field: Field, path: F)where
Facet: From<F>,
Adding a facet to the document.
sourcepub fn add_pre_tokenized_text(
&mut self,
field: Field,
pre_tokenized_text: PreTokenizedString
)
pub fn add_pre_tokenized_text(
&mut self,
field: Field,
pre_tokenized_text: PreTokenizedString
)
Add a pre-tokenized text field.
sourcepub fn add_ip_addr(&mut self, field: Field, value: Ipv6Addr)
pub fn add_ip_addr(&mut self, field: Field, value: Ipv6Addr)
Add a IP address field. Internally only Ipv6Addr is used.
sourcepub fn add_date(&mut self, field: Field, value: DateTime)
pub fn add_date(&mut self, field: Field, value: DateTime)
Add a date field with unspecified time zone offset
sourcepub fn add_json_object(&mut self, field: Field, json_object: Map<String, Value>)
pub fn add_json_object(&mut self, field: Field, json_object: Map<String, Value>)
Add a JSON field
sourcepub fn add_field_value<T: Into<Value>>(&mut self, field: Field, typed_val: T)
pub fn add_field_value<T: Into<Value>>(&mut self, field: Field, typed_val: T)
Add a (field, value) to the document.
sourcepub fn field_values(&self) -> &[FieldValue]
pub fn field_values(&self) -> &[FieldValue]
field_values accessor
sourcepub fn get_sorted_field_values(&self) -> Vec<(Field, Vec<&Value>)>
pub fn get_sorted_field_values(&self) -> Vec<(Field, Vec<&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.
sourcepub fn get_all(&self, field: Field) -> impl Iterator<Item = &Value>
pub fn get_all(&self, field: Field) -> impl Iterator<Item = &Value>
Returns all of the FieldValue
s associated the given field
sourcepub fn get_first(&self, field: Field) -> Option<&Value>
pub fn get_first(&self, field: Field) -> Option<&Value>
Returns the first FieldValue
associated the given field
sourcepub fn serialize_stored<W: Write>(
&self,
schema: &Schema,
writer: &mut W
) -> Result<()>
pub fn serialize_stored<W: Write>(
&self,
schema: &Schema,
writer: &mut W
) -> Result<()>
Serializes stored field values.
Trait Implementations
sourceimpl BinarySerializable for Document
impl BinarySerializable for Document
sourcefn deserialize<R: Read>(reader: &mut R) -> Result<Self>
fn deserialize<R: Read>(reader: &mut R) -> Result<Self>
Deserialize
sourceimpl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Vec<FieldValue, Global>> for Document
impl From<Vec<FieldValue, Global>> for Document
sourcefn from(field_values: Vec<FieldValue>) -> Self
fn from(field_values: Vec<FieldValue>) -> Self
Converts to this type from the input type.
sourceimpl IntoIterator for Document
impl IntoIterator for Document
type Item = FieldValue
type Item = FieldValue
The type of the elements being iterated over.
type IntoIter = IntoIter<FieldValue, Global>
type IntoIter = IntoIter<FieldValue, Global>
Which kind of iterator are we turning this into?
impl Eq for Document
Auto Trait Implementations
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read moresourceimpl<T> DowncastSync for Twhere
T: Any + Send + Sync,
impl<T> DowncastSync for Twhere
T: Any + Send + Sync,
sourcefn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>
Convert
Arc<Trait>
(where Trait: Downcast
) to Arc<Any>
. Arc<Any>
can then be
further downcast
into Arc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourceimpl<T> Pointable for T
impl<T> Pointable for T
impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more