pub struct InvertedFile {
pub lists: Vec<Vec<u32>>,
}Expand description
Inverted file: for each centroid, the sorted list of unique document indices that have at least one token clustered in that centroid.
This mirrors PLAID’s “centroid → unique passage ids” layout from §3 of the paper: candidate generation only needs to know which documents are reachable via a probed centroid, and deduplicating per-doc keeps the posting lists small even when a single document has many tokens mapped to the same cluster.
The search path uses this to expand a query token to a shortlist of document candidates: find the centroids with the highest dot-product against the query token, then gather every document listed under those centroids.
Fields§
§lists: Vec<Vec<u32>>lists[c] holds the sorted, deduplicated doc_idxs of every
document with at least one token assigned to centroid c.
Implementations§
Source§impl InvertedFile
impl InvertedFile
Sourcepub fn num_centroids(&self) -> usize
pub fn num_centroids(&self) -> usize
Total number of centroids the IVF spans.
Sourcepub fn docs_for_centroid(&self, centroid_id: usize) -> &[u32]
pub fn docs_for_centroid(&self, centroid_id: usize) -> &[u32]
Document indices currently associated with centroid_id, or an
empty slice if the centroid is out of range. Entries are sorted
ascending and contain no duplicates.
Sourcepub fn total_doc_postings(&self) -> usize
pub fn total_doc_postings(&self) -> usize
Total number of (centroid, doc) postings across every list.
This is the sum of lists[c].len() over all centroids c. It
is at most num_centroids * num_documents and at least equal
to the number of documents that contain any tokens at all.
Trait Implementations§
Source§impl Clone for InvertedFile
impl Clone for InvertedFile
Source§fn clone(&self) -> InvertedFile
fn clone(&self) -> InvertedFile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InvertedFile
impl Debug for InvertedFile
Source§impl Default for InvertedFile
impl Default for InvertedFile
Source§fn default() -> InvertedFile
fn default() -> InvertedFile
Auto Trait Implementations§
impl Freeze for InvertedFile
impl RefUnwindSafe for InvertedFile
impl Send for InvertedFile
impl Sync for InvertedFile
impl Unpin for InvertedFile
impl UnsafeUnpin for InvertedFile
impl UnwindSafe for InvertedFile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more