Skip to main content

Crate khive_score

Crate khive_score 

Source
Expand description

Cross-platform deterministic scoring via fixed-point i64 (2^32 scale).

Re-exports§

pub use distance::score_from_distance;Deprecated
pub use distance::score_from_distance_lossy;
pub use distance::try_score_from_distance;

Modules§

distance
Canonical distance-to-DeterministicScore conversion for all retrieval backends.

Structs§

DeterministicScore
Fixed-point score wrapping an i64 scaled by 2^32.
Ranked
Scored item implementing max-heap Ord: higher score wins, lower ID breaks ties.

Enums§

ScoreError
Errors produced by score aggregation and distance conversion operations.

Functions§

avg_scores
Return the arithmetic mean of scores, clamped to [NEG_INF, MAX].
avg_scores_checked
Return the mean of scores and a boolean saturation flag.
cmp_asc_then_id
Compare scores ascending, lower ID wins ties.
cmp_desc_then_id
Compare scores descending, lower ID wins ties.
max_score
Return the maximum score, or DeterministicScore::NEG_INF for an empty slice.
min_score
Return the minimum score, or DeterministicScore::MAX for an empty slice.
rrf_score
RRF score 1 / (k + rank). Rank is 1-based; prefer rrf_score_one_based or rrf_score_zero_based.
rrf_score_one_based
RRF score with 1-based rank (first result = rank 1). k is the smoothing constant.
rrf_score_zero_based
RRF score with 0-based index (index 0 → rank 1 internally).
sum_scores
Return the saturating sum of scores, clamped to [NEG_INF, MAX].
weighted_sum
Weighted sum of scores. Errors on length mismatch or non-finite weights.