mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-14 04:52:54 +00:00
Found via these commands:
codespell -L crate,ser,panting,beauti,hart,ue,atleast,childs,ond,pris,hel,mot
markdownlint *.md doc/src/*.md --disable MD013 MD025 MD033 MD001 MD024 MD036 MD041 MD003
27 lines
1011 B
Rust
27 lines
1011 B
Rust
use crate::docset::DocSet;
|
|
|
|
/// 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.
|
|
pub trait Postings: DocSet + 'static {
|
|
/// The number of times the term appears in the document.
|
|
fn term_freq(&self) -> u32;
|
|
|
|
/// Returns the positions offsetted with a given value.
|
|
/// The output vector will be resized to the `term_freq`.
|
|
fn positions_with_offset(&mut self, offset: u32, output: &mut Vec<u32>);
|
|
|
|
/// Returns the positions of the term in the given document.
|
|
/// The output vector will be resized to the `term_freq`.
|
|
fn positions(&mut self, output: &mut Vec<u32>) {
|
|
self.positions_with_offset(0u32, output);
|
|
}
|
|
}
|