Skip to main content

normalize_minmax

Function normalize_minmax 

Source
pub fn normalize_minmax(results: &mut [SearchResult])
Expand description

Normalize scores to [0, 1] in place via min-max scaling.

If the slice is empty this is a no-op. If every score is equal (min == max) all scores are set to 1.0. Otherwise each score becomes (score - min) / (max - min).

Non-finite scores (NaN, ±Infinity) are clamped to 0.0 before scaling so the [0, 1] output contract holds even when an upstream backend emits an invalid score.