NYCPHP Meetup

[nycphp-talk] Advanced Search Techniques

ifarfan at netzero.com ifarfan at netzero.com
Fri Apr 11 15:20:51 EDT 2003


Hi,

Not sure if this helps (this is my first post!) but you may want to look at the SOUNDEX function in MySQL (All major DB vendors provide it, too). Here's a link:

http://www.mysql.com/doc/en/String_functions.html

The soundex listing reads:
SOUNDEX(str)
    Returns a soundex string from str. Two strings that sound almost the same should have identical soundex strings. A standard soundex string is 4 characters long, but the SOUNDEX() function returns an arbitrarily long string. You can use SUBSTRING() on the result to get a standard soundex string. All non-alphanumeric characters are ignored in the given string. All international alpha characters outside the A-Z range are treated as vowels:

mysql> SELECT SOUNDEX('Hello');
        -> 'H400'
mysql> SELECT SOUNDEX('Quadratically');
        -> 'Q36324'

MS-SQL also has a DIFFERENCE function that compares the difference of the SOUNDEX pattern results between 2 strings.

-- Using DIFFERENCE
SELECT DIFFERENCE('Smithers', 'Smythers')
-- The difference returned is 4 (lowest possible difference).


Hope this helps...

Cheers,

Israel F.




> I just pulled in a gig (finally).  They are building a literary
> reference guide. 
 > 
> Well, while planning they hit me with something I'm not too versed in.
> They want to eventually have something they called "fingerprint"
> searching.  The term alone meant nothing to me (beyond the obvious -
> which google agreed with).
 > 
> Basically it has something to do with using synonyms and misspellings
> and all types of other fun algorithms to find what a user is looking
> for.  Does anyone hear have any experience with such things, or maybe
> know where to look?
>  
> Thanks!!
>  
> Mark







More information about the talk mailing list