Re: sound index - Mailing list pgsql-general

From Alex Mayrhofer
Subject Re: sound index
Date
Msg-id 443D4825.9030002@nona.net
Whole thread Raw
In response to Re: sound index  (Teodor Sigaev <teodor@sigaev.ru>)
List 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

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Hardware related question: 3ware 9500S
Next
From: "Ted Byers"
Date:
Subject: Re: Hardware related question: 3ware 9500S