tags:

views:

313

answers:

2

I am trying to do a comparison between company names using SOUNDEX, but the php call for soundex only outputs 3 digits so the comparisons aren't quite accurate. Is there a way to get a better soundex output so that the results are more accurate?

+2  A: 

try using metaphone instead

ʞɔıu
+1  A: 

Depending on what you are SOUNDEXing against, it might be cheaper to do run SOUNDEX() at the database level:

$result = $db->query("
    SELECT
        company.id,
        company.name,
        SOUNDEX(company.name) AS soundex
    FROM
        company
    WHERE
        company.name SOUNDS LIKE '$companyName'
");
yaauie
should I create within the mysql database itself what the soundex index is ahead of time?
AFG
In my opinion, the benefits of doing so (marginal performance increase) do not outweigh the pain/expense (keeping the column in sync). I set up a table with 5000 unique names, indexed name column, and ran SOUNDEX on all. Results: 1.8ms average vs 1.5ms for just retrieving the data without SOUNDEX
yaauie