pub struct CandidateScorer;Expand description
Phase 2: Score candidates from a centroid.
For a single query token and centroid, decompress and score all document tokens assigned to that centroid.
Implementations§
Source§impl CandidateScorer
impl CandidateScorer
Sourcepub fn score(
query_token: &[f32],
centroid_id: usize,
centroid_score: f32,
codec: &ResidualCodec,
sizes: &[usize],
offsets: &[usize],
chunk_ids: &[ChunkId],
token_indices: &[u16],
residuals: &[u8],
bytes_per_residual: usize,
) -> Vec<(ChunkId, u16, f32)>
pub fn score( query_token: &[f32], centroid_id: usize, centroid_score: f32, codec: &ResidualCodec, sizes: &[usize], offsets: &[usize], chunk_ids: &[ChunkId], token_indices: &[u16], residuals: &[u8], bytes_per_residual: usize, ) -> Vec<(ChunkId, u16, f32)>
Score candidates from a centroid for one query token.
§Arguments
query_token- Query embedding for this tokencentroid_id- Selected centroid IDcentroid_score- Precomputed q · ccodec- Residual codec for decompressionsizes- Number of tokens per centroidoffsets- Cumulative offsets per centroidchunk_ids- Chunk IDs for all tokenstoken_indices- Token indices within chunksresiduals- Packed residuals for all tokensbytes_per_residual- Bytes per packed residual
§Returns
Vector of (ChunkId, token_index, score) for all candidates.
Sourcepub fn score_single(
query_token: &[f32],
centroid_id: usize,
centroid_score: f32,
codec: &ResidualCodec,
residual: &[u8],
) -> f32
pub fn score_single( query_token: &[f32], centroid_id: usize, centroid_score: f32, codec: &ResidualCodec, residual: &[u8], ) -> f32
Score a single candidate.
Auto Trait Implementations§
impl Freeze for CandidateScorer
impl RefUnwindSafe for CandidateScorer
impl Send for CandidateScorer
impl Sync for CandidateScorer
impl Unpin for CandidateScorer
impl UnsafeUnpin for CandidateScorer
impl UnwindSafe for CandidateScorer
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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