Re: sound index

From: Alex Mayrhofer <axelm(at)nona(dot)net>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: nikolay(at)samokhvalov(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: sound index
Date: 2006-04-12 18:34:13
Message-ID: 443D4825.9030002@nona.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Teodor Sigaev wrote:

>> also, i'd be happy to listen opinions from people who have experience
>> of usage of such things like soundex.

I'm using metaphone() together with levenshtein() to search a place name
gazetteer database and order the results. That works reasonably well and
gives interesting results ("places with similar names"). However, it does
not cover "partial" matches (it does just compare the whole string, and does
not find multi-word names when just a single word is entered, eg. it would
not find "santa cruz" when you just enter "cruz").

Regarding db structure: I've specifically added a column which contains the
metaphone string (loaded with "UPDATE places set pname_metaphone =
metaphone(pname, 11)") - this row is obviously indexed (and, with functional
indices, actuall redundant ;). i'm then using "SELECT * from places where
pname_metaphone = metaphone('searchstring', 11)" to retrieve similar names.
levenshtein is used to order those rows by string distance.

try it at http://nona.net/features/map/

I haven't attemted yet to combine tsearch2 and metaphone results - that
would probably be the PerfectSolution(tm).

hope that helps

Alex

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ted Byers 2006-04-12 18:53:01 Re: Hardware related question: 3ware 9500S
Previous Message Scott Marlowe 2006-04-12 18:24:09 Re: Hardware related question: 3ware 9500S