Trait tantivy::termdict::TermDictionary
[−]
[src]
pub trait TermDictionary<'a> where
Self: Sized, {
type Streamer: TermStreamer + 'a;
type StreamBuilder: TermStreamerBuilder<Streamer = Self::Streamer> + 'a;
fn from_source(source: ReadOnlySource) -> Self;
fn num_terms(&self) -> usize;
fn term_ord<K: AsRef<[u8]>>(&self, term: K) -> Option<TermOrdinal>;
fn ord_to_term(&self, ord: TermOrdinal, bytes: &mut Vec<u8>) -> bool;
fn term_info_from_ord(&self, term_ord: TermOrdinal) -> TermInfo;
fn get<K: AsRef<[u8]>>(&self, target_key: K) -> Option<TermInfo>;
fn range(&'a self) -> Self::StreamBuilder;
fn stream(&'a self) -> Self::Streamer { ... }
fn stream_field(&'a self, field: Field) -> Self::Streamer { ... }
}
Dictionary associating sorted &[u8]
to values
Associated Types
type Streamer: TermStreamer + 'a
Streamer type associated to the term dictionary
type StreamBuilder: TermStreamerBuilder<Streamer = Self::Streamer> + 'a
StreamerBuilder type associated to the term dictionary
Required Methods
fn from_source(source: ReadOnlySource) -> Self
Opens a TermDictionary
given a data source.
fn num_terms(&self) -> usize
Returns the number of terms in the dictionary.
Term ordinals range from 0 to num_terms() - 1
.
fn term_ord<K: AsRef<[u8]>>(&self, term: K) -> Option<TermOrdinal>
Returns the ordinal associated to a given term.
fn ord_to_term(&self, ord: TermOrdinal, bytes: &mut Vec<u8>) -> bool
Returns the term associated to a given term ordinal.
Term ordinals are defined as the position of the term in the sorted list of terms.
Returns true iff the term has been found.
Regardless of whether the term is found or not, the buffer may be modified.
fn term_info_from_ord(&self, term_ord: TermOrdinal) -> TermInfo
Returns the number of terms in the dictionary.
fn get<K: AsRef<[u8]>>(&self, target_key: K) -> Option<TermInfo>
Lookups the value corresponding to the key.
fn range(&'a self) -> Self::StreamBuilder
Returns a range builder, to stream all of the terms within an interval.
Provided Methods
fn stream(&'a self) -> Self::Streamer
A stream of all the sorted terms. See also .stream_field()
fn stream_field(&'a self, field: Field) -> Self::Streamer
A stream of all the sorted terms in the given field.
Implementors
impl<'a> TermDictionary<'a> for TermDictionaryImpl type Streamer = TermStreamerImpl<'a>; type StreamBuilder = TermStreamerBuilderImpl<'a>;