pub trait VectorStoreIndex: WasmCompatSend + WasmCompatSync {
type Filter: SearchFilter + WasmCompatSend + WasmCompatSync;
// Required methods
fn top_n<T: for<'a> Deserialize<'a> + WasmCompatSend>(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + WasmCompatSend;
fn top_n_ids(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + WasmCompatSend;
}Expand description
Trait for vector store indexes
Required Associated Types§
type Filter: SearchFilter + WasmCompatSend + WasmCompatSync
Required Methods§
Sourcefn top_n<T: for<'a> Deserialize<'a> + WasmCompatSend>(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + WasmCompatSend
fn top_n<T: for<'a> Deserialize<'a> + WasmCompatSend>( &self, req: VectorSearchRequest<Self::Filter>, ) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + WasmCompatSend
Get the top n documents based on the distance to the given query. The result is a list of tuples of the form (score, id, document)
Sourcefn top_n_ids(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + WasmCompatSend
fn top_n_ids( &self, req: VectorSearchRequest<Self::Filter>, ) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + WasmCompatSend
Same as top_n but returns the document ids only.
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.