Use invariant lower-casing in StringMatcher so I/i match under tr-TR and az

ME
9d ago
+24-3

StringMatcher lower-cases the query and the candidate text with the culture-sensitive ToLower() / char.ToLower() (three places). Under tr-TR and az, I lower-cases to the dotless ı, while a typed i stays i. So for a Turkish or Azerbaijani Windows user, the query inst doesn't match Install Package and internet doesn't match Internet Explorer. This happens with the default settings (IgnoreAccents = false). The existing FuzzyMatcherTest.MatchTest already fails on a tr-TR machine for this reason (the inst / Install Package assertion).

The three calls now use ToLowerInvariant() / char.ToLowerInvariant(), as DiacriticsNormalizer already does.

Trade-off to be aware of. With invariant casing, a Turkish word typed with a dotless ı no longer matches the same word written with a capital I (e.g. query ılık vs title ILIK). Today that case works and the much more common ASCII case (inst vs Install) doesn't. If you'd rather keep Turkish-specific matching too, comparing both the invariant and the current-culture lower-case forms would cover both; happy to change it that way.

Tests. FuzzyMatcherTest.WhenCurrentCultureHasDottedAndDotlessI_ThenIgnoreCaseMatchShouldStillWork (tr-TR and az-Latn-AZ) sets the culture, restores it afterwards and checks internet / Internet Explorer, INTERNET / internet explorer and internet exp / Internet Explorer.

Ran (net9.0-windows, tr-TR machine):

  • FuzzyMatcherTest: 3 failed / 90 passed before (the two new cases plus MatchTest), 93/93 after.
  • Full Flow.Launcher.Test: 515/516 after. The remaining LoadAsync_WhenFileNonExistent_StillReturnsBackupDataAsync failure also fails on dev without this change.
  • global.json pins SDK 9.0.x, which I don't have, so I pinned 10.0.400 locally. That change isn't in the commit.

This change was written with Claude Code.

🤖 Generated with Claude Code


Summary by cubic

Summary of changes

StringMatcher lower-cased query and candidate text with culture-sensitive ToLower() / char.ToLower(), which maps I to the dotless ı under Turkish (tr-TR) and Azerbaijani (az) cultures. This caused queries like inst to fail matching Install Package. The three call sites now use ToLowerInvariant() / char.ToLowerInvariant(), matching the approach already used in DiacriticsNormalizer.

Known trade-off: a Turkish word typed with a dotless ı no longer matches the same word written with a capital I (e.g. ılık vs ILIK). Today that case works but the much more common ASCII case does not.

  • No existing logic was removed; only the lower-casing calls were replaced.
  • No memory usage impact.
  • No security risk.
  • Unit tests: added WhenCurrentCultureHasDottedAndDotlessI_ThenIgnoreCaseMatchShouldStillWork covering tr-TR and az-Latn-AZ cultures, verifying internet vs Internet Explorer, INTERNET vs internet explorer, and internet exp vs Internet Explorer.

Release Note

Fixes search so typed letters match results correctly for Turkish and Azerbaijani users.