pub struct Index {
pub params: IndexParams,
pub codec: ResidualCodec,
pub doc_ids: Vec<u64>,
pub doc_tokens: Vec<Vec<EncodedVector>>,
pub ivf: InvertedFile,
}Expand description
A fully-built PLAID index over a corpus of multi-vector embeddings.
Holds the trained codec, the encoded token embeddings of every document, and an inverted file mapping centroids back to the tokens clustered in them. Future layers (search) will read from this state directly without mutating it.
Fields§
§params: IndexParams§codec: ResidualCodec§doc_ids: Vec<u64>§doc_tokens: Vec<Vec<EncodedVector>>doc_tokens[i] is the encoded token sequence of the i-th document.
ivf: InvertedFileCentroid → tokens inverted file used for candidate generation.
Implementations§
Source§impl Index
impl Index
Sourcepub fn num_documents(&self) -> usize
pub fn num_documents(&self) -> usize
Number of documents currently stored in the index.
Sourcepub fn num_tokens(&self) -> usize
pub fn num_tokens(&self) -> usize
Total number of encoded tokens across all documents.
Sourcepub fn position_of(&self, doc_id: u64) -> Option<usize>
pub fn position_of(&self, doc_id: u64) -> Option<usize>
Find the position of a document inside Index::doc_ids.
Trait Implementations§
Auto Trait Implementations§
impl Freeze 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
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>
Converts
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>
Converts
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