Closed kisaragi-hiu closed 1 year ago
Actually, LIKE is case-insensitive by default.
The problem I faced was that when I was searching Ǹg-bāng
, it didn't return any result even though it should. I thought this is an issue with casing, but after ensuring Unicode normalization it started working.
With the issue resolved, smart case is probably actually not necessary. AI
and other loan words from English acronyms are probably the only cases where the word has just one correct casing, and they're unique enough to not be buried in entries with the wrong casing.
Updated the title because I keep getting confused by what has been done and what not.
The problem is SQLite COLLATE NOCASE only knows about ASCII characters. (We can't just downcase everything because the case matters for some words (like "AI" for instance).) We need to do an NFD normalization before saving into database.
in getHetFromUrl: do the smart case logic; do the database query accordingly; return whether smart case is on......for WordPreview, so the exact match marker can be aware of smart case