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-
DeterministicScoreconversion for all retrieval backends.
Structs§
- Deterministic
Score - Fixed-point score wrapping an
i64scaled by2^32. - Ranked
- Scored item implementing max-heap
Ord: higher score wins, lower ID breaks ties.
Enums§
- Score
Error - 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
scoresand 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_INFfor an empty slice. - min_
score - Return the minimum score, or
DeterministicScore::MAXfor an empty slice. - rrf_
score - RRF score
1 / (k + rank). Rank is 1-based; preferrrf_score_one_basedorrrf_score_zero_based. - rrf_
score_ one_ based - RRF score with 1-based rank (first result = rank 1).
kis 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.