Skip to main content

TextCandidateScorer

Struct TextCandidateScorer 

Source
pub struct TextCandidateScorer { /* private fields */ }
Expand description

Scores aligned emitted query terms, including duplicates, after support acceptance.

Implementations§

Source§

impl TextCandidateScorer

Source

pub fn new( mode: &ScoringMode, stats: IndexStats, document_frequencies: &[u64], ) -> Result<Self, TextSearchError>

Source

pub fn new_budgeted( mode: &ScoringMode, stats: IndexStats, document_frequencies: &[u64], budget: &MemoryBudget, poll: impl FnMut() -> Result<(), TextSearchError>, ) -> Result<Self, TextSearchError>

Reserve query IDFs and scalar statistics from the caller’s shared runtime allowance.

Only scalar statistics are needed because frequencies arrive in emitted query order. Unused vocabulary maps are dropped, and the native scorer is stored inline. The callback covers construction and IDF preparation; partial owners are released on failure.

Source

pub fn score_document( &mut self, document_length: u64, term_frequencies: &[u64], ) -> Result<f64, TextSearchError>

Source

pub fn score_document_with_control( &self, document_length: u64, term_frequencies: &[u64], poll: impl FnMut() -> Result<(), TextSearchError>, ) -> Result<f64, TextSearchError>

Sum native term contributions in emitted order and apply calibration once, without a temporary score vector.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.