pub struct TantivyDocument {
pub node_data: Vec<u8>,
/* private fields */
}Expand description
The default document in tantivy. It encodes data in a compact form.
Fields§
§node_data: Vec<u8>node_data is a vec of bytes, where each value is serialized into bytes and stored. It
includes all the data of the document and also metadata like where the nodes are located
in an object or array.
Implementations§
Source§impl CompactDoc
impl CompactDoc
Sourcepub fn with_capacity(bytes: usize) -> CompactDoc
pub fn with_capacity(bytes: usize) -> CompactDoc
Creates a new, empty document object The reserved capacity is for the total serialized data
Sourcepub fn new() -> CompactDoc
pub fn new() -> CompactDoc
Creates a new, empty document object
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Skrinks the capacity of the document to fit the data
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_object(&mut self, field: Field, object: BTreeMap<String, OwnedValue>)
pub fn add_object(&mut self, field: Field, object: BTreeMap<String, OwnedValue>)
Add a dynamic object field
Sourcepub fn add_field_value<'a, V: Value<'a>>(&mut self, field: Field, value: V)
pub fn add_field_value<'a, V: Value<'a>>(&mut self, field: Field, value: V)
Add a (field, value) to the document.
OwnedValue implements Value, which should be easiest to use, but is not the most
performant.
Sourcepub fn add_leaf_field_value<'a, T: Into<ReferenceValueLeaf<'a>>>(
&mut self,
field: Field,
typed_val: T,
)
pub fn add_leaf_field_value<'a, T: Into<ReferenceValueLeaf<'a>>>( &mut self, field: Field, typed_val: T, )
Add a (field, leaf value) to the document. Leaf values don’t have nested values.
Sourcepub fn field_values(&self) -> impl Iterator<Item = (Field, CompactDocValue<'_>)>
pub fn field_values(&self) -> impl Iterator<Item = (Field, CompactDocValue<'_>)>
field_values accessor
Sourcepub fn get_all(
&self,
field: Field,
) -> impl Iterator<Item = CompactDocValue<'_>> + '_
pub fn get_all( &self, field: Field, ) -> impl Iterator<Item = CompactDocValue<'_>> + '_
Returns all of the ReferenceValues associated the given field
Sourcepub fn get_first(&self, field: Field) -> Option<CompactDocValue<'_>>
pub fn get_first(&self, field: Field) -> Option<CompactDocValue<'_>>
Returns the first ReferenceValue associated the given field
Sourcepub fn convert_named_doc(
schema: &Schema,
named_doc: NamedFieldDocument,
) -> Result<Self, DocParsingError>
pub fn convert_named_doc( schema: &Schema, named_doc: NamedFieldDocument, ) -> Result<Self, DocParsingError>
Create document from a named doc.
Sourcepub fn parse_json(
schema: &Schema,
doc_json: &str,
) -> Result<Self, DocParsingError>
pub fn parse_json( schema: &Schema, doc_json: &str, ) -> Result<Self, DocParsingError>
Build a document object from a json-object.
Sourcepub fn from_json_object(
schema: &Schema,
json_obj: Map<String, Value>,
) -> Result<Self, DocParsingError>
pub fn from_json_object( schema: &Schema, json_obj: Map<String, Value>, ) -> Result<Self, DocParsingError>
Build a document object from a json-object.
Trait Implementations§
Source§impl Clone for CompactDoc
impl Clone for CompactDoc
Source§fn clone(&self) -> CompactDoc
fn clone(&self) -> CompactDoc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompactDoc
impl Debug for CompactDoc
Source§impl Default for CompactDoc
impl Default for CompactDoc
Source§impl Document for CompactDoc
impl Document for CompactDoc
Source§type Value<'a> = CompactDocValue<'a>
type Value<'a> = CompactDocValue<'a>
Source§type FieldsValuesIter<'a> = FieldValueIterRef<'a>
type FieldsValuesIter<'a> = FieldValueIterRef<'a>
Source§fn iter_fields_and_values(&self) -> Self::FieldsValuesIter<'_>
fn iter_fields_and_values(&self) -> Self::FieldsValuesIter<'_>
Source§fn get_sorted_field_values(&self) -> Vec<(Field, Vec<Self::Value<'_>>)>
fn get_sorted_field_values(&self) -> Vec<(Field, Vec<Self::Value<'_>>)>
Source§fn to_named_doc(&self, schema: &Schema) -> NamedFieldDocument
fn to_named_doc(&self, schema: &Schema) -> NamedFieldDocument
Source§impl DocumentDeserialize for CompactDoc
impl DocumentDeserialize for CompactDoc
Source§fn deserialize<'de, D>(deserializer: D) -> Result<Self, DeserializeError>where
D: DocumentDeserializer<'de>,
fn deserialize<'de, D>(deserializer: D) -> Result<Self, DeserializeError>where
D: DocumentDeserializer<'de>,
impl Eq for CompactDoc
Auto Trait Implementations§
impl Freeze for CompactDoc
impl RefUnwindSafe for CompactDoc
impl Send for CompactDoc
impl Sync for CompactDoc
impl Unpin for CompactDoc
impl UnsafeUnpin for CompactDoc
impl UnwindSafe for CompactDoc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> Fruit for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more