Skip to main content

normalize_query

Function normalize_query 

Source
pub fn normalize_query(text: &str) -> String
Expand description

Normalize text for fuzzy matching: NFC + lowercase + strip Polish diacritics.

NFC canonical composition is applied first so NFD-stored variants (e.g. o + combining acute) collapse to the same code points as NFC-stored composed variants (ó) before diacritic mapping. Without this step, źródło typed via NFD on one platform would refuse to match the same word typed via NFC on another.

Maps: ą→a, ć→c, ę→e, ł→l, ń→n, ó→o, ś→s, ź→z, ż→z Enables “wdrozenie” to match “wdrożenie”, “zrodlo” to match “źródło”, etc.