I hate to be the one to break this to you, but
soundex('Callaghan') != soundex('Callahan')

It's just the sad truth: the algorithm thinks they are pronounced
differently, so it doesn't consider them to match.

soundex() is certainly better than nothing, but in many cases not much
better. I'm not sure whether even MetaPhone (a more robust soundex variant)
would get this case right, and all the mis-spelling systems I've ever
implemented have been suplemented with a set of heuristics (like searching
for all single-letter drops, adds, and transpositions) and often a
mis-spelling database in an attempt to find suggested alternatives.

-rob

On 7/6/02 at 11:39 pm, Dave Callaghan <[EMAIL PROTECTED]> wrote:

> I want to use SOUNDEX for name queries, but I don't 
> seem to be doing it correctly. 
> 
> As a test, I made a small table and popluated it 
> with my name. My goal is to be able to find my name 
> 'Callaghan', with its most common misspelling 
> 'Callahan'. 
> 
> I've read the MySQL doc, so I know how to actually 
> invoke soundex at the mysql prompt. I read an 
> article that said soundex queries move more quickly 
> if you add a column for the soundex.
> 
> Thus:
> 
> CREATE TABLE sound (
>   id tinyint(3) NOT NULL auto_increment,
>   name varchar(100) default NULL,
>   sound varchar(100) default NULL,
>   PRIMARY KEY  (id)
> ) TYPE=MyISAM;
> 
> select soundex('Callaghan');
> result = C425
> 
> INSERT INTO sound VALUES (1, 'Callaghan', 'C425');
> 
> Simple enough. Now, I expected all three of the 
> following queries to return a value. 
> 
> select id from sound where sound = 
> soundex('Callaghan');
> returns 1 records
> 
> select id from sound where sound = 
> soundex('Callahan');
> returns 0 records
> 
> select id from sound where name = 
> soundex('Callaghan');
> returns 0 records
> 
> I'm missing something obvious here, but I've read 
> the doc and I'm not sure what's wrong.
> 
> -- 
> Get your free email from www.linuxmail.org 
> 
> 
> Powered by Outblaze
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to