From: | momjian(at)svr1(dot)postgresql(dot)org (Bruce Momjian) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql-server/contrib/fuzzystrmatch README.fuzz ... |
Date: | 2003-06-24 22:59:46 |
Message-ID: | 20030624225946.A967430FA78@svr1.postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
CVSROOT: /cvsroot
Module name: pgsql-server
Changes by: momjian(at)svr1(dot)postgresql(dot)org 03/06/24 19:59:46
Modified files:
contrib/fuzzystrmatch: README.fuzzystrmatch fuzzystrmatch.c
fuzzystrmatch.h
Log message:
Jim C. Nasby wrote:
> Second argument to metaphone is suposed to set the limit on the
> number of characters to return, but it breaks on some phrases:
>
> usps=# select metaphone(a,3),metaphone(a,4),metaphone(a,20) from
> (select 'Hello world'::varchar AS a) a;
> HLW | HLWR | HLWRLT
>
> usps=# select metaphone(a,3),metaphone(a,4),metaphone(a,20) from
> (select 'A A COMEAUX MEMORIAL'::varchar AS a) a;
> AKM | AKMKS | AKMKSMMRL
>
> In every case I've found that does this, the 4th and 5th letters are
> always 'KS'.
Nice catch.
There was a bug in the original metaphone algorithm from CPAN. Patch
attached (while I was at it I updated my email address, changed the
copyright to PGDG, and removed an unnecessary palloc). Here's how it
looks now:
regression=# select metaphone(a,4) from (select 'A A COMEAUX
MEMORIAL'::varchar AS a) a;
metaphone
-----------
AKMK
(1 row)
regression=# select metaphone(a,5) from (select 'A A COMEAUX
MEMORIAL'::varchar AS a) a;
metaphone
-----------
AKMKS
(1 row)
Joe Conway
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-06-24 23:05:20 | pgsql-server/doc TODO |
Previous Message | Bruce Momjian | 2003-06-24 22:42:42 | pgsql-server/src/backend/utils/adt inet_net_ntop.c |