pub fn relevance_score(
query: &str,
query_terms: &[&str],
text_lower: &str,
importance: u8,
) -> f32Expand description
Score how well a block answers a text query.
The old ranking used depth alone, so a shallow fragment of noise always came before the exact fact the user asked for. This combines three signals:
- Phrase precision — the whole query appearing verbatim is the strongest signal; every query term appearing separately is weaker.
- Importance — the block’s recorded importance (0-10), lightly weighted.
- Specificity — a short block that is mostly the query beats a long block that merely mentions it somewhere.