Struct tantivy::Term[][src]

pub struct Term<B = Vec<u8>>(_)
where
    B: AsRef<[u8]>
;

Term represents the value that the token can take.

It actually wraps a Vec<u8>.

Methods

impl Term
[src]

Builds a term given a field, and a u64-value

Assuming the term has a field id of 1, and a u64 value of 3234, the Term will have 8 bytes.

The first four byte are dedicated to storing the field id as a u64. The 4 following bytes are encoding the u64 value.

Creates a Term given a facet.

Builds a term given a field, and a string value

Assuming the term has a field id of 2, and a text value of "abc", the Term will have 4 bytes. The first byte is 2, and the three following bytes are the utf-8 representation of "abc".

Builds a term given a field, and a u64-value

Assuming the term has a field id of 1, and a u64 value of 3234, the Term will have 8 bytes.

The first four byte are dedicated to storing the field id as a u64. The 4 following bytes are encoding the u64 value.

Returns the field.

Sets a u64 value in the term.

U64 are serialized using (8-byte) BigEndian representation. The use of BigEndian has the benefit of preserving the natural order of the values.

Sets a i64 value in the term.

Set the texts only, keeping the field untouched.

impl<B> Term<B> where
    B: AsRef<[u8]>, 
[src]

Wraps a source of data

Returns the field.

Returns the u64 value stored in a term.

Panics

... or returns an invalid value if the term is not a u64 field.

Returns the i64 value stored in a term.

Panics

... or returns an invalid value if the term is not a i64 field.

Returns the text associated with the term.

Panics

If the value is not valid utf-8. This may happen if the index is corrupted or if you try to call this method on a non-string type.

Important traits for &'a [u8]

Returns the serialized value of the term. (this does not include the field.)

If the term is a string, its value is utf-8 encoded. If the term is a u64, its value is encoded according to byteorder::LittleEndian.

Important traits for &'a [u8]

Returns the underlying &[u8]

Trait Implementations

impl<B: Clone> Clone for Term<B> where
    B: AsRef<[u8]>, 
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<B: PartialEq> PartialEq for Term<B> where
    B: AsRef<[u8]>, 
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<B: PartialOrd> PartialOrd for Term<B> where
    B: AsRef<[u8]>, 
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<B: Ord> Ord for Term<B> where
    B: AsRef<[u8]>, 
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<B: Eq> Eq for Term<B> where
    B: AsRef<[u8]>, 
[src]

impl<B: Hash> Hash for Term<B> where
    B: AsRef<[u8]>, 
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<B> AsRef<[u8]> for Term<B> where
    B: AsRef<[u8]>, 
[src]

Important traits for &'a [u8]

Performs the conversion.

impl Debug for Term
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<B> Send for Term<B> where
    B: Send

impl<B> Sync for Term<B> where
    B: Sync