Skip to main content

MultiVectorIndex

Struct MultiVectorIndex 

Source
pub struct MultiVectorIndex { /* private fields */ }
Expand description

Deterministic vector index allowing multiple vectors per caller key.

Implementations§

Source§

impl MultiVectorIndex

Source

pub fn build( config: IndexConfig, vectors: &[MultiVectorRef<'_>], ) -> Result<Self, SearchError>

Builds one HNSW node per unique (key, vector_id) pair.

Input order does not affect internal IDs or graph construction.

§Errors

Returns typed config, vector, duplicate identity, capacity, or allocation errors.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub const fn dimensions(&self) -> usize

Source

pub fn config(&self) -> &IndexConfig

Source

pub fn estimated_memory_bytes(&self) -> usize

Source

pub fn search( &self, query: &[f32], count: usize, ) -> Result<Vec<MultiSearchHit>, SearchError>

Returns top vectors, allowing repeated caller keys.

§Errors

Returns a typed query or allocation error.

Source

pub fn search_exact( &self, query: &[f32], count: usize, ) -> Result<Vec<MultiSearchHit>, SearchError>

Returns exact top vectors, allowing repeated caller keys.

§Errors

Returns a typed query or allocation error.

Source

pub fn search_unique_keys( &self, query: &[f32], count: usize, ) -> Result<Vec<MultiSearchHit>, SearchError>

Returns at most one best vector for each caller key.

The approximate pass widens candidates; an exact fallback fills sparse key distributions.

§Errors

Returns a typed query or allocation error.

Source

pub fn search_filtered<F>( &self, query: &[f32], count: usize, filter: F, ) -> Result<Vec<MultiSearchHit>, SearchError>
where F: Fn(MultiVectorKey) -> bool,

Searches only identities accepted by filter.

§Errors

Returns a typed query or allocation error.

Source

pub fn search_batch( &self, queries: &[&[f32]], count: usize, ) -> Result<Vec<Vec<MultiSearchHit>>, SearchError>

Searches independent queries with bounded workers.

§Errors

Returns the first query or worker error.

Source§

impl MultiVectorIndex

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, SearchError>

Serializes the graph and caller-visible (key, vector_id) identities.

§Errors

Returns a capacity or allocation error.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, SearchError>

Restores and validates a graph and its multi-vector identities.

§Errors

Returns a format, integrity, graph, or allocation error.

Source

pub fn write_to(&self, writer: impl Write) -> Result<(), SearchError>

Writes a complete multi-vector snapshot to a stream.

§Errors

Returns a serialization or stream error.

Source

pub fn read_from(reader: impl Read) -> Result<Self, SearchError>

Reads a complete multi-vector snapshot from a stream.

§Errors

Returns a stream, format, or integrity error.

Source

pub fn save(&self, path: impl AsRef<Path>) -> Result<(), SearchError>

Atomically saves a complete multi-vector snapshot.

§Errors

Returns a serialization or filesystem error.

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self, SearchError>

Loads a complete multi-vector snapshot.

§Errors

Returns a filesystem, format, or integrity error.

Trait Implementations§

Source§

impl Debug for MultiVectorIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.