pub struct Document(/* private fields */);
Expand description
A document in a Xapian database
Implementations§
Source§impl Document
impl Document
Sourcepub fn add_boolean_term(&mut self, term: impl AsRef<str>)
pub fn add_boolean_term(&mut self, term: impl AsRef<str>)
Add a boolean term to the document
Sourcepub fn add_posting(
&mut self,
term: impl AsRef<str>,
pos: c_uint,
increment: impl Into<Option<c_uint>>,
)
pub fn add_posting( &mut self, term: impl AsRef<str>, pos: c_uint, increment: impl Into<Option<c_uint>>, )
Add an occurrence of term
at the position given by pos
Sourcepub fn add_term(
&mut self,
term: impl AsRef<str>,
increment: impl Into<Option<c_uint>>,
)
pub fn add_term( &mut self, term: impl AsRef<str>, increment: impl Into<Option<c_uint>>, )
Add a term to the document, without positional information
Sourcepub fn clear_terms(&mut self)
pub fn clear_terms(&mut self)
Remove all terms and postings from the document
Sourcepub fn remove_term(&mut self, term: impl AsRef<str>)
pub fn remove_term(&mut self, term: impl AsRef<str>)
Remove term
and all postings associated with it from this document
Sourcepub fn set_data(&mut self, data: impl AsRef<[u8]>)
pub fn set_data(&mut self, data: impl AsRef<[u8]>)
Set the data blob stored alongside this document
Sourcepub fn set_value(&mut self, slot: impl Into<Slot>, value: impl ToValue)
pub fn set_value(&mut self, slot: impl Into<Slot>, value: impl ToValue)
Set the value stored in the given slot number
Xapian values are stored as strings, but are often more useful in some other form.
To accomodate this, ToValue
is used to serialize data in a
Xapian-friendly fashion. This trait is already implemented for most numeric primitives,
string types and byte collections.
Sourcepub fn value<T: FromValue>(
&self,
slot: impl Into<Slot>,
) -> Option<Result<T, T::Error>>
pub fn value<T: FromValue>( &self, slot: impl Into<Slot>, ) -> Option<Result<T, T::Error>>
Retrieve the value (if any) stored in the given slot number
Xapian values are stored as strings, but are often more useful in some other form.
To accomodate this, FromValue
is used to deserialize data
from its Xapian representation. This trait is already implemented for most numeric
primitives, string types and byte collections.
Returns None
when there is no value stored in slot
Returns Some(Err(T::Error)
when there is a value but deserialization fails
Returns Some(Ok(T))
otherwise