Skip to main content

MappedVectorIndex

Struct MappedVectorIndex 

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

Read-only HNSW index backed directly by a versioned memory-mapped snapshot.

Implementations§

Source§

impl MappedVectorIndex

Source

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

Opens and fully validates a read-only memory-mapped snapshot.

§Errors

Returns a typed storage, version, integrity, or config error.

Source

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

Opens a read-only snapshot with an explicit validation policy.

§Errors

Returns a typed storage, version, integrity, or config error.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn dimensions(&self) -> usize

Source

pub fn config(&self) -> &IndexConfig

Source

pub fn mapped_bytes(&self) -> usize

Returns the mapped file length. Query scratch and the small graph-layout table are excluded.

Source

pub fn keys(&self) -> impl ExactSizeIterator<Item = u64> + '_

Iterates stable keys in ascending order.

Source

pub fn vector(&self, key: u64) -> Option<&[f32]>

Returns the normalized mapped vector for key.

Source§

impl MappedVectorIndex

Source

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

Searches mapped queries using bounded standard-library workers.

§Errors

Returns the first query error in input order or a worker-panic error.

Source

pub fn search_batch_with_policy( &self, queries: &[&[f32]], count: usize, policy: SearchPolicy, ) -> Result<Vec<Vec<SearchHit>>, SearchError>

Searches mapped queries with a shared per-query recall policy.

§Errors

Returns the first query error in input order or a worker-panic error.

Source§

impl MappedVectorIndex

Source

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

Returns exact top-K hits directly from mapped vectors.

§Errors

Returns a typed error for an invalid query.

Source

pub fn search_exact_filtered<F>( &self, query: &[f32], count: usize, filter: F, ) -> Result<Vec<SearchHit>, SearchError>
where F: FnMut(u64) -> bool,

Returns exact top-K mapped hits accepted by filter.

§Errors

Returns a typed error for an invalid query.

Source

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

Searches mapped HNSW candidates accepted by filter, with an exact fallback for selective filters.

§Errors

Returns a typed query or allocation error.

Source

pub fn search_filtered_with_policy<F>( &self, query: &[f32], count: usize, filter: F, policy: FilterSearchPolicy, ) -> Result<Vec<SearchHit>, SearchError>
where F: Fn(u64) -> bool,

Searches a mapped graph with the predicate applied during traversal.

§Errors

Returns a typed query or allocation error.

Source§

impl MappedVectorIndex

Source

pub fn to_owned(&self) -> Result<VectorIndex, SearchError>

Materializes the mapped index without rebuilding its graph.

§Errors

Returns an allocation, integrity, or config error.

Source§

impl MappedVectorIndex

Source

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

Returns approximate top-K hits ordered by exact distance and key.

§Errors

Returns a typed error for an invalid query or scratch allocation.

Source

pub fn search_with_policy( &self, query: &[f32], count: usize, policy: SearchPolicy, ) -> Result<Vec<SearchHit>, SearchError>

Returns approximate top-K hits with a per-query recall policy.

§Errors

Returns a typed error for an invalid policy, query, or scratch allocation.

Trait Implementations§

Source§

impl Debug for MappedVectorIndex

Source§

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

Formats the value using the given formatter. Read more
Source§

impl SearchShard for MappedVectorIndex

Source§

fn dimensions(&self) -> usize

Source§

fn search_shard( &self, query: &[f32], count: usize, ) -> Result<Vec<SearchHit>, SearchError>

Searches this shard. 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.