- Notifications
You must be signed in to change notification settings - Fork28
Commit7b1f6ff
committed
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. Patchattached (while I was at it I updated my email address, changed thecopyright to PGDG, and removed an unnecessary palloc). Here's how itlooks now:regression=# select metaphone(a,4) from (select 'A A COMEAUXMEMORIAL'::varchar AS a) a; metaphone----------- AKMK(1 row)regression=# select metaphone(a,5) from (select 'A A COMEAUXMEMORIAL'::varchar AS a) a; metaphone----------- AKMKS(1 row)Joe Conway1 parent4b1fe23 commit7b1f6ff
File tree
3 files changed
+14
-7
lines changed- contrib/fuzzystrmatch
3 files changed
+14
-7
lines changedLines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 |
| |
8 | 11 |
| |
9 | 12 |
| |
|
Lines changed: 6 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 |
| |
8 | 11 |
| |
9 | 12 |
| |
| |||
221 | 224 |
| |
222 | 225 |
| |
223 | 226 |
| |
224 |
| - | |
225 |
| - | |
226 |
| - | |
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
| |||
629 | 629 |
| |
630 | 630 |
| |
631 | 631 |
| |
632 |
| - | |
| 632 | + | |
| 633 | + | |
633 | 634 |
| |
634 | 635 |
| |
635 | 636 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 |
| |
8 | 11 |
| |
9 | 12 |
| |
|
0 commit comments
Comments
(0)