Skip to main content

Retriever

Trait Retriever 

Source
pub trait Retriever {
    type Query;
    type Result;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn search(&self, query: Self::Query, k: usize) -> Result<Vec<Self::Result>>;
    fn search_with_context(
        &self,
        query: Self::Query,
        context: &str,
        k: usize,
    ) -> Result<Vec<Self::Result>>;
    fn update(&mut self, content: Vec<String>) -> Result<()>;
}
Expand description

Text retrieval abstraction for finding relevant content

§Synchronous Version

This trait provides synchronous operations for content retrieval.

Required Associated Types§

Source

type Query

The query type this retriever accepts

Source

type Result

The result type this retriever returns

Source

type Error: Error + Send + Sync + 'static

The error type returned by retrieval operations

Required Methods§

Source

fn search(&self, query: Self::Query, k: usize) -> Result<Vec<Self::Result>>

Perform a search query

Source

fn search_with_context( &self, query: Self::Query, context: &str, k: usize, ) -> Result<Vec<Self::Result>>

Perform a search with additional context

Source

fn update(&mut self, content: Vec<String>) -> Result<()>

Update the retriever with new content

Implementors§