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 i64 score scaled by 2^32, with saturating deterministic arithmetic.
Ranked
Max-heap ranking item: higher score wins and lower ID breaks ties.

Enums§

ScoreError
Validation errors from aggregation and distance conversion.

Functions§

avg_scores
Return the arithmetic mean of scores, clamped to [NEG_INF, MAX].
avg_scores_checked
Return the mean and whether absolute input mass or the result approaches saturation.
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
Return a saturating weighted sum.