pub struct VectorStore { /* private fields */ }Expand description
Enhanced vector store with embedding management and advanced features
Implementations§
Source§impl VectorStore
impl VectorStore
Sourcepub fn with_embedding_strategy(strategy: EmbeddingStrategy) -> Result<Self>
pub fn with_embedding_strategy(strategy: EmbeddingStrategy) -> Result<Self>
Create vector store with specific embedding strategy
Sourcepub fn with_index(index: Box<dyn VectorIndex>) -> Self
pub fn with_index(index: Box<dyn VectorIndex>) -> Self
Create vector store with custom index
Sourcepub fn with_index_and_embeddings(
index: Box<dyn VectorIndex>,
strategy: EmbeddingStrategy,
) -> Result<Self>
pub fn with_index_and_embeddings( index: Box<dyn VectorIndex>, strategy: EmbeddingStrategy, ) -> Result<Self>
Create vector store with custom index and embedding strategy
Sourcepub fn with_config(self, config: VectorStoreConfig) -> Self
pub fn with_config(self, config: VectorStoreConfig) -> Self
Set vector store configuration
Sourcepub fn index_resource(&mut self, uri: String, content: &str) -> Result<()>
pub fn index_resource(&mut self, uri: String, content: &str) -> Result<()>
Index a resource with automatic embedding generation
Sourcepub fn index_rdf_resource(
&mut self,
uri: String,
label: Option<String>,
description: Option<String>,
properties: HashMap<String, Vec<String>>,
) -> Result<()>
pub fn index_rdf_resource( &mut self, uri: String, label: Option<String>, description: Option<String>, properties: HashMap<String, Vec<String>>, ) -> Result<()>
Index an RDF resource with structured content
Sourcepub fn index_vector(&mut self, uri: String, vector: Vector) -> Result<()>
pub fn index_vector(&mut self, uri: String, vector: Vector) -> Result<()>
Index a pre-computed vector
Sourcepub fn similarity_search(
&self,
query: &str,
limit: usize,
) -> Result<Vec<(String, f32)>>
pub fn similarity_search( &self, query: &str, limit: usize, ) -> Result<Vec<(String, f32)>>
Search for similar resources using text query
Sourcepub fn similarity_search_vector(
&self,
query: &Vector,
limit: usize,
) -> Result<Vec<(String, f32)>>
pub fn similarity_search_vector( &self, query: &Vector, limit: usize, ) -> Result<Vec<(String, f32)>>
Search for similar resources using a vector query
Sourcepub fn threshold_search(
&self,
query: &str,
threshold: f32,
) -> Result<Vec<(String, f32)>>
pub fn threshold_search( &self, query: &str, threshold: f32, ) -> Result<Vec<(String, f32)>>
Find resources within similarity threshold
Sourcepub fn advanced_search(
&self,
options: SearchOptions,
) -> Result<Vec<(String, f32)>>
pub fn advanced_search( &self, options: SearchOptions, ) -> Result<Vec<(String, f32)>>
Advanced search with multiple options
Sourcepub fn embedding_stats(&self) -> Option<(usize, usize)>
pub fn embedding_stats(&self) -> Option<(usize, usize)>
Get embedding manager statistics
Sourcepub fn build_vocabulary(&mut self, documents: &[String]) -> Result<()>
pub fn build_vocabulary(&mut self, documents: &[String]) -> Result<()>
Build vocabulary for TF-IDF embeddings
Sourcepub fn calculate_similarity(&self, uri1: &str, uri2: &str) -> Result<f32>
pub fn calculate_similarity(&self, uri1: &str, uri2: &str) -> Result<f32>
Calculate similarity between two resources by their URIs
Sourcepub fn get_vector(&self, id: &str) -> Option<&Vector>
pub fn get_vector(&self, id: &str) -> Option<&Vector>
Get a vector by its ID (delegates to VectorIndex)
Sourcepub fn index_vector_with_metadata(
&mut self,
uri: String,
vector: Vector,
_metadata: HashMap<String, String>,
) -> Result<()>
pub fn index_vector_with_metadata( &mut self, uri: String, vector: Vector, _metadata: HashMap<String, String>, ) -> Result<()>
Index a vector with metadata (stub)
Sourcepub fn index_resource_with_metadata(
&mut self,
uri: String,
content: &str,
_metadata: HashMap<String, String>,
) -> Result<()>
pub fn index_resource_with_metadata( &mut self, uri: String, content: &str, _metadata: HashMap<String, String>, ) -> Result<()>
Index a resource with metadata (stub)
Sourcepub fn similarity_search_with_params(
&self,
query: &str,
limit: usize,
_params: HashMap<String, String>,
) -> Result<Vec<(String, f32)>>
pub fn similarity_search_with_params( &self, query: &str, limit: usize, _params: HashMap<String, String>, ) -> Result<Vec<(String, f32)>>
Search with additional parameters (stub)
Sourcepub fn vector_search_with_params(
&self,
query: &Vector,
limit: usize,
_params: HashMap<String, String>,
) -> Result<Vec<(String, f32)>>
pub fn vector_search_with_params( &self, query: &Vector, limit: usize, _params: HashMap<String, String>, ) -> Result<Vec<(String, f32)>>
Vector search with additional parameters (stub)
Sourcepub fn get_vector_ids(&self) -> Result<Vec<String>>
pub fn get_vector_ids(&self) -> Result<Vec<String>>
Get all vector IDs (stub)
Sourcepub fn remove_vector(&mut self, uri: &str) -> Result<()>
pub fn remove_vector(&mut self, uri: &str) -> Result<()>
Remove a vector by its URI (stub)
Sourcepub fn save_to_disk(&self, _path: &str) -> Result<()>
pub fn save_to_disk(&self, _path: &str) -> Result<()>
Save store to disk (stub)
Sourcepub fn load_from_disk(_path: &str) -> Result<Self>
pub fn load_from_disk(_path: &str) -> Result<Self>
Load store from disk (stub)
Sourcepub fn optimize_index(&mut self) -> Result<()>
pub fn optimize_index(&mut self) -> Result<()>
Optimize the underlying index (stub)
Trait Implementations§
Source§impl Default for VectorStore
impl Default for VectorStore
Source§impl VectorStoreTrait for VectorStore
impl VectorStoreTrait for VectorStore
Auto Trait Implementations§
impl Freeze for VectorStore
impl !RefUnwindSafe for VectorStore
impl Send for VectorStore
impl Sync for VectorStore
impl Unpin for VectorStore
impl !UnwindSafe for VectorStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.