postings
Postings-list primitives for inverted indices, packaged as a small Rust crate.
Data Model & Invariants
- Doc IDs:
u32. Must be dense/contiguous for optimal compression. - Ordering: Postings lists are always sorted by Doc ID.
- Updates: Segment-based. Deletions are tombstones; updates are delete+add.
- Storage: In-memory by default. Persistence via
durability(optional).
Stability & Publishing
This crate is stable for internal use. Public API may change.
Use git dependencies for now.
What it is
postings is an in-memory, index-only inverted index meant for candidate generation:
- it does not store document text
- it supports “segment-style” updates
- it provides no-false-negative candidate sets
Usage
Add postings to your Cargo.toml:
[]
= { = "https://github.com/arclabs561/postings" }
Example (index + candidates):
use ;
let mut idx = new;
idx.add_document
.unwrap;
idx.add_document
.unwrap;
// Conjunctive (AND) candidates.
assert_eq!;
let cfg = default;
let plan = idx.plan_candidates;
assert!;
Features
postings/serde: enable serde for the in-memory structures.postings/persistence: enable save/load helpers viadurability+postcard.postings/sbits: enable succinct monotone sequences (Elias–Fano) underpostings::codec::ef.postings/positional: enable positional postings (postings::positional::PosingsIndex).postings/roc: enable optional compressed-candidate helpers underpostings::positional::roc_candidates.
Optional: positional postings
Enable positional postings behind a feature flag:
[]
= { = "https://github.com/arclabs561/postings", = ["positional"] }
Then use postings::positional::PosingsIndex for phrase/proximity evaluation.
Development