Struct tantivy::Document [−][src]
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.
Methods
impl Document
[src]
impl Document
pub fn new() -> Document
[src]
pub fn new() -> Document
Creates a new, empty document object
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of (field, value)
pairs.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true iff the document contains no fields.
pub fn filter_fields<P: Fn(Field) -> bool>(&mut self, predicate: P)
[src]
pub fn filter_fields<P: Fn(Field) -> bool>(&mut self, predicate: P)
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>,
[src]
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]
pub fn add_text(&mut self, field: Field, text: &str)
Add a text field.
pub fn add_u64(&mut self, field: Field, value: u64)
[src]
pub fn add_u64(&mut self, field: Field, value: u64)
Add a u64 field
pub fn add_i64(&mut self, field: Field, value: i64)
[src]
pub fn add_i64(&mut self, field: Field, value: i64)
Add a u64 field
pub fn add_bytes(&mut self, field: Field, value: Vec<u8>)
[src]
pub fn add_bytes(&mut self, field: Field, value: Vec<u8>)
Add a bytes field
pub fn add(&mut self, field_value: FieldValue)
[src]
pub fn add(&mut self, field_value: FieldValue)
Add a field value
pub fn field_values(&self) -> &[FieldValue]
[src]
pub fn field_values(&self) -> &[FieldValue]
field_values accessor
pub fn get_sorted_field_values(&self) -> Vec<(Field, Vec<&FieldValue>)>
[src]
pub fn get_sorted_field_values(&self) -> Vec<(Field, Vec<&FieldValue>)>
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]
pub fn get_all(&self, field: Field) -> Vec<&Value>
Returns all of the FieldValue
s associated the given field
pub fn get_first(&self, field: Field) -> Option<&Value>
[src]
pub fn get_first(&self, field: Field) -> Option<&Value>
Returns the first FieldValue
associated the given field
Trait Implementations
impl Clone for Document
[src]
impl Clone for Document
fn clone(&self) -> Document
[src]
fn clone(&self) -> Document
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Document
[src]
impl Debug for Document
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Document
[src]
impl Default for Document
impl From<Vec<FieldValue>> for Document
[src]
impl From<Vec<FieldValue>> for Document
fn from(field_values: Vec<FieldValue>) -> Self
[src]
fn from(field_values: Vec<FieldValue>) -> Self
Performs the conversion.
impl PartialEq for Document
[src]
impl PartialEq for Document
fn eq(&self, other: &Document) -> bool
[src]
fn eq(&self, other: &Document) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Document
[src]
impl Eq for Document