Skip to main content

ScalarQuantizedIndex

Struct ScalarQuantizedIndex 

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

Compact scalar-int8 cosine index.

Stored vectors use one byte per component plus one norm scalar. Search distances are quantized approximations unless Self::search_rerank is used with an owned f32 index.

Implementations§

Source§

impl ScalarQuantizedIndex

Source

pub fn build( config: IndexConfig, vectors: &[(u64, &[f32])], ) -> Result<Self, SearchError>

Validates, normalizes, and quantizes dense vectors.

§Errors

Returns typed config, vector, duplicate-key, 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 const fn config(&self) -> &IndexConfig

Source

pub fn estimated_memory_bytes(&self) -> usize

Allocation-based retained size estimate.

Source

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

Returns scalar-int8 approximate cosine hits.

§Errors

Returns a typed query validation or allocation error.

Source

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

Retrieves a wider quantized candidate set and re-scores it with exact normalized f32 vectors from oracle.

§Errors

Returns a typed query, missing-key, or allocation error.

Source

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

Searches independent queries with bounded workers.

§Errors

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

Trait Implementations§

Source§

impl Debug for ScalarQuantizedIndex

Source§

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

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

impl SearchShard for ScalarQuantizedIndex

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.