Trait tantivy::postings::Postings

source ·
pub trait Postings: DocSet + 'static {
    // Required methods
    fn term_freq(&self) -> u32;
    fn positions_with_offset(&mut self, offset: u32, output: &mut Vec<u32>);

    // Provided method
    fn positions(&mut self, output: &mut Vec<u32>) { ... }
}
Expand description

Postings (also called inverted list)

For a given term, it is the list of doc ids of the doc containing the term. Optionally, for each document, it may also give access to the term frequency as well as the list of term positions.

Its main implementation is SegmentPostings, but other implementations mocking SegmentPostings exist, for merging segments or for testing.

Required Methods§

source

fn term_freq(&self) -> u32

The number of times the term appears in the document.

source

fn positions_with_offset(&mut self, offset: u32, output: &mut Vec<u32>)

Returns the positions offsetted with a given value. The output vector will be resized to the term_freq.

Provided Methods§

source

fn positions(&mut self, output: &mut Vec<u32>)

Returns the positions of the term in the given document. The output vector will be resized to the term_freq.

Implementors§