Trait IvfSubIndex

Source
pub trait IvfSubIndex:
    Send
    + Sync
    + Debug
    + DeepSizeOf {
    type QueryParams: Send + Sync + for<'a> From<&'a Query>;
    type BuildParams: Clone + Send + Sync;

    // Required methods
    fn load(data: RecordBatch) -> Result<Self>
       where Self: Sized;
    fn name() -> &'static str;
    fn metadata_key() -> &'static str;
    fn schema() -> SchemaRef;
    fn search(
        &self,
        query: ArrayRef,
        k: usize,
        params: Self::QueryParams,
        storage: &impl VectorStore,
        prefilter: Arc<dyn PreFilter>,
    ) -> Result<RecordBatch>;
    fn index_vectors(
        storage: &impl VectorStore,
        params: Self::BuildParams,
    ) -> Result<Self>
       where Self: Sized;
    fn remap(&self, mapping: &HashMap<u64, Option<u64>>) -> Result<Self>
       where Self: Sized;
    fn to_batch(&self) -> Result<RecordBatch>;
}
Expand description

A sub index for IVF index

Required Associated Types§

Required Methods§

Source

fn load(data: RecordBatch) -> Result<Self>
where Self: Sized,

Load the sub index from a record batch with a single row

Source

fn name() -> &'static str

Source

fn metadata_key() -> &'static str

Source

fn schema() -> SchemaRef

Return the schema of the sub index

Source

fn search( &self, query: ArrayRef, k: usize, params: Self::QueryParams, storage: &impl VectorStore, prefilter: Arc<dyn PreFilter>, ) -> Result<RecordBatch>

Search the sub index for nearest neighbors.

§Arguments:
  • query - The query vector
  • k - The number of nearest neighbors to return
  • params - The query parameters
  • prefilter - The prefilter object indicating which vectors to skip
Source

fn index_vectors( storage: &impl VectorStore, params: Self::BuildParams, ) -> Result<Self>
where Self: Sized,

Given a vector storage, containing all the data for the IVF partition, build the sub index.

Source

fn remap(&self, mapping: &HashMap<u64, Option<u64>>) -> Result<Self>
where Self: Sized,

Source

fn to_batch(&self) -> Result<RecordBatch>

Encode the sub index into a record batch

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§