On 12/22/09 11:31 , "Sylvain Pointeau" <sylvain.point...@gmail.com> wrote:
> Imagine that I want to query my database for a certain type of word, > the user could enter ü or ue and I will display the corresponding items... > > It cannot be done in the application layer... > Or maybe it can... You could for example maintain in your application, possibly in a SQLite table for that purpose, all equivalence classes of all characters. The obvious optimisation is to omit an equivalence class when it's a singleton. So you are left with a few equivalence classes that may look like this: ü, ue ä, ae, æ e, é, è, ê, ë (or whatever). Now, when the user enters a query string, you construct a set of query string variations: you loop over all characters of the query string, and for each of them you replace that character in turn with each member of its equivalence class. Now you executes the query against all query string variations, and the final result set is the union of all individual result sets. One way for this is to do it depth-first with a recursive procedure. There are ways to use SQLite to build up the union of the result sets. Whether all this is easy or can run in a reasonable time depends on your application profile, esp the number and size of the equivalence classes, the length of the query strings, and the individual expected size of the result sets. If you can get a way with *some* hits rather that *all* hits, then you can cut the querying whenever a query returns a non-empty set. Of course, what do I know? Maybe I missed a showstopper. Jean-Denis _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users