[][src]Struct tantivy::Document

pub struct Document { /* fields omitted */ }

Tantivy's Document is the object that can be indexed and then searched for.

Documents are fundamentally a collection of unordered couple (field, value). In this list, one field may appear more than once.

Documents are really just a list of couple (field, value). In this list, one field may appear more than once.


impl Document[src]

pub fn new() -> Document[src]

Creates a new, empty document object

pub fn len(&self) -> usize[src]

Returns the number of (field, value) pairs.

pub fn is_empty(&self) -> bool[src]

Returns true iff the document contains no fields.

pub fn filter_fields<P: Fn(Field) -> bool>(&mut self, predicate: P)[src]

Retain only the field that are matching the predicate given in argument.

pub fn add_facet<F>(&mut self, field: Field, path: F) where
    Facet: From<F>, 

Adding a facet to the document.

pub fn add_text(&mut self, field: Field, text: &str)[src]

Add a text field.

pub fn add_u64(&mut self, field: Field, value: u64)[src]

Add a u64 field

pub fn add_i64(&mut self, field: Field, value: i64)[src]

Add a i64 field

pub fn add_f64(&mut self, field: Field, value: f64)[src]

Add a f64 field

pub fn add_date(&mut self, field: Field, value: &DateTime)[src]

Add a date field

pub fn add_bytes(&mut self, field: Field, value: Vec<u8>)[src]

Add a bytes field

pub fn add(&mut self, field_value: FieldValue)[src]

Add a field value

pub fn field_values(&self) -> &[FieldValue][src]

field_values accessor

pub fn get_sorted_field_values(&self) -> Vec<(Field, Vec<&FieldValue>)>[src]

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.

pub fn get_all(&self, field: Field) -> Vec<&Value>[src]

Returns all of the FieldValues associated the given field

pub fn get_first(&self, field: Field) -> Option<&Value>[src]

Returns the first FieldValue associated the given field

Trait Implementations

impl From<Vec<FieldValue>> for Document[src]

impl Clone for Document[src]

impl Default for Document[src]

impl Eq for Document[src]

impl PartialEq<Document> for Document[src]

impl Debug for Document[src]

impl Serialize for Document[src]

impl<'de> Deserialize<'de> for Document[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Fruit for T where
    T: Send + Downcast

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 

impl<T> Erased for T[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any