Re: search on accents over all possible matches

From: David Lizano <david(dot)lizano(at)izanet(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: search on accents over all possible matches
Date: 2001-03-27 17:00:21
Message-ID: 4.3.2.7.0.20010327185220.00c1cc10@192.168.1.1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

At 18.24 27/3/01 +0200, you wrote:
>Hello,
>
>I'm developing a search tool with php against a posgresql database.
>As the database is in catalan an in spanish is obvious that a simple
>search like:
>(SELECT * FROM painters WHERE artist_name ~* 'Dali');
>
>should perform over Dd Aa Ll Ii (and will not found Dalí).
>but on an accent based language also should perform over ÍíÌìÏï
>
>question is:
>
>this c function from Patrice Hédé is the most appropiate tool for
>searching on an accent based language ?
>http://www.postgresql.org/mhonarc/pgsql-sql/1998-06/msg00119.html
>
>or should I use an implemented function inside postgres right now ?
>
>bests from barcelona,
>jaume teixi.

Using regular expressions from PHP you can convert "a" into "[Aaáä]" and
from the original SQL query:
(SELECT * FROM painters WHERE artist_name ~* 'Dali');

You obtain
(SELECT * FROM painters WHERE artist_name ~* 'D[Aaáä]l[Iiíï]');

generating a new complete regular expression for the SQL language.

It should be valid for Dali, Dáli, Dalí, Dálí, and others.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Lizano - Director área técnica
correo-e: david(dot)lizano(at)izanet(dot)com

I Z A N E T - Servicios integrales de internet.
web: http://www.izanet.com/
Dirección: C/ Checa, 57-59, 3º D - 50.007 Zaragoza (España)
Teléfono: +34 976 25 80 23 Fax: +34 976 25 80 24
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-27 17:24:34 Re: search on accents over all possible matches
Previous Message Jaume Teixi 2001-03-27 16:35:19 non postgres user need to perform COPY