Skip to main content

score

Function score 

Source
pub fn score(needle: &str, title: &str, secondary: &[&str]) -> f64
Expand description

How well haystack answers needle, in 0.0..=1.0.

Deliberately simple and the same for every type, because the point is that hits are comparable across types — a per-type relevance number nobody can reconcile is what the client already had. An exact title beats a prefix beats a substring; matching a secondary field (a slug, a filename, body text) scores below any title match.