Skip to main content

RetrieverEngine

Trait RetrieverEngine 

Source
pub trait RetrieverEngine: Send + Sync {
    // Required methods
    fn index<'life0, 'async_trait>(
        &'life0 self,
        documents: Vec<Document>,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn retrieve<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        top_k: usize,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn hybrid_retrieve<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        top_k: usize,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        doc_ids: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn clear<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn hybrid_retrieve_with_config<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        top_k: usize,
        config: &'life2 HybridSearchConfig,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn retrieve_with_filter<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        top_k: usize,
        filter: Option<MetadataFilter>,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

检索引擎 trait

提供向量相似度检索能力。

Required Methods§

Source

fn index<'life0, 'async_trait>( &'life0 self, documents: Vec<Document>, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

索引文档

Source

fn retrieve<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, top_k: usize, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

检索相似文档

Source

fn hybrid_retrieve<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, top_k: usize, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

混合检索(向量 + 关键词)

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, doc_ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

删除文档

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

清空索引

Source

fn count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer3Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

获取文档数量

Provided Methods§

Source

fn hybrid_retrieve_with_config<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, top_k: usize, config: &'life2 HybridSearchConfig, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

带配置的混合检索

Source

fn retrieve_with_filter<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, top_k: usize, filter: Option<MetadataFilter>, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<RetrievalResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

带过滤条件的检索

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§