MillinMo
MillinMo

Reputation: 435

Sql Server Soundex Name search - find shortened form of a name

I would like to allow my app to search for names and return similar first names. I.e. if the user searches for John, Jonathan's should be returned as well.

A Soundex search does not seem to do this. Are there any alternatives other than storing a dictionary of related names?

Upvotes: 2

Views: 1173

Answers (2)

gintas
gintas

Reputation: 2178

You should look at Levenshtein Edit Distance, and look for strings with low edit distance comparing to target string.

Here is more info and implementation of it for SQL Server

http://www.kodyaz.com/articles/fuzzy-string-matching-using-levenshtein-distance-sql-server.aspx


Edit distance shows minimum number of edits (character deletions, replacements or insertions) you need to make to a string to get your target string.

So for example 'apple' and 'aple' will have an edit distance of 1 (deletion of 'p');

3rd party edit

The code from kodyaz.com points to a posting from Arnold Fribble on the sqlteam.com/forums You can find the code in this question from 2009

Upvotes: 1

TomTom
TomTom

Reputation: 62093

No, there is not - because you look for an interpretation of similiarity, not a similar sounding thing. Keeping alternatives is your only choice.

Upvotes: 1

Related Questions