May 27, 2003

To LOWER or not toLower()

Today we are debugging a problem with our search code. Everything works fine (thanks Victor) except Zenkaku Romaji. It appears that the search is creating case insenstive SQL by using Java's toLower() on the query string and then using LOWER on the data column in SQL to complete the search query. This has one broken assumption that Java's toLower() and, in the current case in question, Postgres's LOWER produce the same result. They don't! The answer it seems is to use ILIKE (Japanese Link).

This is easier said than done! Also I'm concerned about whether other databases support ILIKE or not.

Later: my trusty (Japanese) coworker after thinking about it mentions that if we use the database's LOWER to lowercase both the query and data column then we will solve the problem. Doh!

Posted by stuartcw at May 27, 2003 04:43 PM
Comments