pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael A Nachbaur <mike@nachbaur.com>
To: pgsql-sql@postgresql.org
Subject: RFC: i18n2ascii(TEXT) stored procedure
Date: Thu, 25 Sep 2003 16:50:53 -0700
Message-ID: <200309251650.53855.mike@nachbaur.com> (raw)

I've created the following stored procedure to allow me to do 
international-insensitive text searches, e.g. a search for "Resume" would 
match the text "Résumé".

I wanted to know:

a) am I missing any characters that need to be converted?  My first (and only 
language) is English, so I'm in the dark when that is concerned;
b) is there a better and/or faster way of implementing this?  I don't want 
searches to bog down (at least too badly) as a result of this.

CREATE OR REPLACE FUNCTION i18n2ascii (TEXT) RETURNS TEXT AS '
    my ($source) = @_;
    $source =~ 
tr/áàâäéèêëíìîïóòôöúùûüÁÀÂÄÉÈÊËÍÌÎÏÓÒÔÖÚÙÛÜ/aaaaeeeeiiiioooouuuuAAAAEEEEIIIIOOOOUUUU/;
    return $source;
' LANGUAGE 'plperl';

-- 
/* Michael A. Nachbaur <mike@nachbaur.com>
 * http://nachbaur.com/pgpkey.asc
 */

"Ah, " said Arthur, "this is obviously some strange usage 
of the word safe that I wasn't previously aware of. "




view thread (5+ messages)  latest in thread

Message-ID: <200309251650.53855.mike@nachbaur.com>
Permalink:  ../200309251650.53855.mike@nachbaur.com/
Also on:    postgresql.org/message-id/200309251650.53855.mike@nachbaur.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@nachbaur.com
  Subject: Re: RFC: i18n2ascii(TEXT) stored procedure
  In-Reply-To: <200309251650.53855.mike@nachbaur.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox