match_rank

Function match_rank 

Source
pub fn match_rank(name: &str, query_lower: &str) -> u8
Expand description

What: Rank how well a package name matches a query (lower is better).

Inputs:

  • name: Package name to match against.
  • query_lower: Query string (must be lowercase).

Output:

  • Returns a u8 rank: 0 = exact match, 1 = prefix match, 2 = substring match, 3 = no match.

Details:

  • Expects query_lower to be lowercase; the name is lowercased internally.
  • Returns 3 (no match) if the query is empty.