prospector
prospector

Reputation: 3469

finding similar keywords in sql

I want to be able to find keywords in my database.

Currently I am using the like wildcard '%keyword%'; however if the database contains text for strawberries, and the keyword is strawberry, then it will return no results.

How can I search for plural and singular words for each result, is this possible without more indepth coding?

Upvotes: 0

Views: 144

Answers (2)

John Powell
John Powell

Reputation: 12571

In all mainstream databases there is full text search and indexing. However to find a word spelt slightly differently you either need to consider something like levenshtein distance (there is a Postgres extension for this) or consider stemming, a concept from natural language processing whereby you store the root of the word and ignore the various endings nouns and verbs can take.

I'm not sure what db you are using, but there is a very good article here about fuzzy string searching options in Posgtres: http://www.postgresonline.com/journal/archives/158-Where-is-soundex-and-other-warm-and-fuzzy-string-things.html

Upvotes: 1

Mladen Prajdic
Mladen Prajdic

Reputation: 15677

Full-Text Search is used for this in SQL Server.

Upvotes: 1

Related Questions