match_positions_graphemes

Function match_positions_graphemes 

Source
pub fn match_positions_graphemes(
    query: &str,
    candidate: &str,
) -> Option<Vec<usize>>
Expand description

Returns grapheme indices in candidate that match query in order.

Matching is case-insensitive by Unicode NFKC + lowercase folding.

Case folding may expand a single grapheme into multiple folded units (for example, ß → ss). Returned positions are still grapheme indices in the original candidate and collapse multi-unit folds to a single position, which is suitable for highlighting.

  • If query is empty, returns Some(vec![]).
  • If all graphemes in query can be matched in order, returns their positions as grapheme indices in candidate.
  • Otherwise returns None.

This function performs no scoring. For a scored matcher that also returns match positions suitable for highlighting, use fuzzy_match_positions_graphemes.