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?

Dori
  • 915
  • 1
  • 12
  • 20
AFG
  • 1,675
  • 3
  • 22
  • 23

2 Answers2

4

try using metaphone instead

ʞɔıu
  • 47,148
  • 35
  • 106
  • 149
1

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'
");
Ry Biesemeyer
  • 1,484
  • 11
  • 10
  • should I create within the mysql database itself what the soundex index is ahead of time? – AFG Jan 09 '09 at 18:27
  • 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 – Ry Biesemeyer Jan 11 '09 at 23:13