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§
type QueryParams: Send + Sync + for<'a> From<&'a Query>
type BuildParams: Clone + Send + Sync
Required Methods§
Sourcefn load(data: RecordBatch) -> Result<Self>where
Self: Sized,
fn load(data: RecordBatch) -> Result<Self>where
Self: Sized,
Load the sub index from a record batch with a single row
fn name() -> &'static str
fn metadata_key() -> &'static str
Sourcefn search(
&self,
query: ArrayRef,
k: usize,
params: Self::QueryParams,
storage: &impl VectorStore,
prefilter: Arc<dyn PreFilter>,
) -> Result<RecordBatch>
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 vectork
- The number of nearest neighbors to returnparams
- The query parametersprefilter
- The prefilter object indicating which vectors to skip
Sourcefn index_vectors(
storage: &impl VectorStore,
params: Self::BuildParams,
) -> Result<Self>where
Self: Sized,
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.
fn remap(&self, mapping: &HashMap<u64, Option<u64>>) -> Result<Self>where
Self: Sized,
Sourcefn to_batch(&self) -> Result<RecordBatch>
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.