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]

[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.

[src]

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".

[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.

[src]

Returns the field.

[src]

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.

[src]

Sets a i64 value in the term.

[src]

Set the texts only, keeping the field untouched.

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

[src]

Wraps a source of data

[src]

Returns the field.

[src]

Returns the u64 value stored in a term.

Panics

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

[src]

Returns the i64 value stored in a term.

Panics

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

[src]

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]
[src]

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]
[src]

Returns the underlying &[u8]

Trait Implementations

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

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

[src]

This method tests for !=.

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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]

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

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]

[src]

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

1.3.0
[src]

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]
[src]

Performs the conversion.

impl Debug for Term
[src]

[src]

Formats the value using the given formatter. Read more