pub struct Index {
pub meta: Meta,
/* private fields */
}Expand description
A read-only index, memory mapped. Only the FSTs are copied in memory; postings, bitmaps and documents are read in place on demand.
Reading never trusts the file: every offset is bounds checked and the
FSTs’ checksums verified, so a damaged or tampered index fails to open
or yields empty lookups, never a panic. Whether the content is genuine
is a matter of signatures (see signed), not of this type.
Fields§
§meta: MetaImplementations§
Source§impl Index
impl Index
pub fn open(path: &Path) -> Result<Self, GeocoderError>
pub fn token_id(&self, token: &str) -> Option<u32>
pub fn token_fst(&self) -> &Map<Vec<u8>>
Sourcepub fn frequency(&self, token: u32) -> usize
pub fn frequency(&self, token: u32) -> usize
Number of documents holding the token (Redis ZCARD).
Sourcepub fn top(&self, token: u32, limit: usize) -> impl Iterator<Item = u32> + '_
pub fn top(&self, token: u32, limit: usize) -> impl Iterator<Item = u32> + '_
The first limit documents of a token, like ZREVRANGE key 0 limit-1.
Sourcepub fn pairs(&self, token: u32) -> RoaringBitmap
pub fn pairs(&self, token: u32) -> RoaringBitmap
Tokens seen in at least one document along with token.
Sourcepub fn edge_ngram(&self, prefix: &str) -> RoaringBitmap
pub fn edge_ngram(&self, prefix: &str) -> RoaringBitmap
Tokens starting with prefix (and longer than it).
pub fn geohash(&self, cell: &str) -> RoaringBitmap
Sourcepub fn filter(&self, key: &str, value: &str) -> RoaringBitmap
pub fn filter(&self, key: &str, value: &str) -> RoaringBitmap
Documents whose filter key has value.
pub fn document(&self, doc: u32) -> Option<Document>
Auto Trait Implementations§
impl Forget for Index
impl Freeze for Index
impl Move for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more