Skip to main content

CrossEncoder

Trait CrossEncoder 

Source
pub trait CrossEncoder: Send + Sync {
    // Required method
    fn score<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        docs: &'life2 [Document],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Scores (query, doc) pairs.

Required Methods§

Source

fn score<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, docs: &'life2 [Document], ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Score every doc against query. Higher = more relevant. Implementations should batch when possible.

Implementors§

Source§

impl<F> CrossEncoder for FnCrossEncoder<F>
where F: Fn(&str, &Document) -> f32 + Send + Sync,