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)
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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<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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.