pub struct RetrievalSystem { /* private fields */ }Expand description
Retrieval system for querying the knowledge graph
Implementations§
Source§impl RetrievalSystem
impl RetrievalSystem
Sourcepub fn with_parallel_processing(
vector_store: Arc<dyn VectorStore>,
embedding_generator: EmbeddingGenerator,
parallel_processor: ParallelProcessor,
) -> Result<Self>
pub fn with_parallel_processing( vector_store: Arc<dyn VectorStore>, embedding_generator: EmbeddingGenerator, parallel_processor: ParallelProcessor, ) -> Result<Self>
Create a new retrieval system with parallel processing support
Sourcepub async fn index_graph(&self, graph: &KnowledgeGraph) -> Result<()>
pub async fn index_graph(&self, graph: &KnowledgeGraph) -> Result<()>
Index a knowledge graph for retrieval
Sourcepub fn initialize_enriched(
&mut self,
config: Option<EnrichedRetrievalConfig>,
) -> Result<()>
pub fn initialize_enriched( &mut self, config: Option<EnrichedRetrievalConfig>, ) -> Result<()>
Initialize enriched metadata-aware retrieval system
Sourcepub fn query(&self, query: &str) -> Result<Vec<String>>
pub fn query(&self, query: &str) -> Result<Vec<String>>
Query the system for relevant information
Sourcepub async fn hybrid_query(
&mut self,
query: &str,
graph: &KnowledgeGraph,
) -> Result<Vec<SearchResult>>
pub async fn hybrid_query( &mut self, query: &str, graph: &KnowledgeGraph, ) -> Result<Vec<SearchResult>>
Advanced hybrid query with strategy selection and hierarchical integration
Sourcepub async fn hybrid_query_with_trees(
&mut self,
query: &str,
graph: &KnowledgeGraph,
document_trees: &HashMap<DocumentId, DocumentTree>,
) -> Result<Vec<SearchResult>>
pub async fn hybrid_query_with_trees( &mut self, query: &str, graph: &KnowledgeGraph, document_trees: &HashMap<DocumentId, DocumentTree>, ) -> Result<Vec<SearchResult>>
Hybrid query with access to document trees for hierarchical retrieval
Sourcepub async fn legacy_hybrid_query(
&mut self,
query: &str,
graph: &KnowledgeGraph,
) -> Result<Vec<SearchResult>>
pub async fn legacy_hybrid_query( &mut self, query: &str, graph: &KnowledgeGraph, ) -> Result<Vec<SearchResult>>
Query the system using hybrid retrieval (vector + graph) - legacy method
Sourcepub async fn add_embeddings_to_graph(
&mut self,
graph: &mut KnowledgeGraph,
) -> Result<()>
pub async fn add_embeddings_to_graph( &mut self, graph: &mut KnowledgeGraph, ) -> Result<()>
Add embeddings to chunks and entities in the graph with parallel processing
Sourcepub async fn batch_query(
&mut self,
queries: &[&str],
graph: &KnowledgeGraph,
) -> Result<Vec<Vec<SearchResult>>>
pub async fn batch_query( &mut self, queries: &[&str], graph: &KnowledgeGraph, ) -> Result<Vec<Vec<SearchResult>>>
Parallel batch query processing with optimized workload distribution Batch process multiple queries efficiently
Sourcepub fn analyze_query(
&self,
query: &str,
graph: &KnowledgeGraph,
) -> Result<QueryAnalysis>
pub fn analyze_query( &self, query: &str, graph: &KnowledgeGraph, ) -> Result<QueryAnalysis>
Analyze query to determine optimal retrieval strategy
Sourcepub async fn execute_adaptive_retrieval(
&mut self,
query: &str,
query_embedding: &[f32],
graph: &KnowledgeGraph,
document_trees: &HashMap<DocumentId, DocumentTree>,
analysis: &QueryAnalysis,
) -> Result<Vec<SearchResult>>
pub async fn execute_adaptive_retrieval( &mut self, query: &str, query_embedding: &[f32], graph: &KnowledgeGraph, document_trees: &HashMap<DocumentId, DocumentTree>, analysis: &QueryAnalysis, ) -> Result<Vec<SearchResult>>
Execute adaptive retrieval based on query analysis
Sourcepub async fn comprehensive_search(
&self,
query_embedding: &[f32],
graph: &KnowledgeGraph,
) -> Result<Vec<SearchResult>>
pub async fn comprehensive_search( &self, query_embedding: &[f32], graph: &KnowledgeGraph, ) -> Result<Vec<SearchResult>>
Comprehensive search that combines multiple retrieval strategies (legacy)
Sourcepub async fn vector_search(
&mut self,
query: &str,
max_results: usize,
) -> Result<Vec<SearchResult>>
pub async fn vector_search( &mut self, query: &str, max_results: usize, ) -> Result<Vec<SearchResult>>
Vector-based search
Sourcepub fn graph_search(
&self,
query: &str,
max_results: usize,
) -> Result<Vec<SearchResult>>
pub fn graph_search( &self, query: &str, max_results: usize, ) -> Result<Vec<SearchResult>>
Graph-based search
Sourcepub fn public_hierarchical_search(
&self,
query: &str,
max_results: usize,
) -> Result<Vec<SearchResult>>
pub fn public_hierarchical_search( &self, query: &str, max_results: usize, ) -> Result<Vec<SearchResult>>
Hierarchical search (public wrapper)
Sourcepub fn bm25_search(
&self,
query: &str,
max_results: usize,
) -> Result<Vec<SearchResult>>
pub fn bm25_search( &self, query: &str, max_results: usize, ) -> Result<Vec<SearchResult>>
BM25-based search
Sourcepub fn get_statistics(&self) -> RetrievalStatistics
pub fn get_statistics(&self) -> RetrievalStatistics
Get retrieval statistics
Sourcepub fn save_state_to_json(&self, file_path: &str) -> Result<()>
pub fn save_state_to_json(&self, file_path: &str) -> Result<()>
Save retrieval system state to JSON file
Auto Trait Implementations§
impl Freeze for RetrievalSystem
impl !RefUnwindSafe for RetrievalSystem
impl Send for RetrievalSystem
impl Sync for RetrievalSystem
impl Unpin for RetrievalSystem
impl UnsafeUnpin for RetrievalSystem
impl !UnwindSafe for RetrievalSystem
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 more