Question

I know there is a similar thread but it has no useful answer.

I am using SQLITE (can not change language) and when a user fills out a form one of the fields is Category.

I want them to enter a category for example, they can enter: gardening.

But if that category already exists 'Gardening' or they mispell it, it will add an entry and cause issues when I am searching.

I want to know if it's possible to use SOUNDEX on the entry to match it against the database, and if an entry exists which is say 80% similar or something it will give a message:

Did you mean (category)?

Which will be a link that when clicked will change the field entry.

Quite alot I am looking for, so thanks in advance for any help.

UPDATE: My Database has the values which will be similar to. So:

CATEGORY:

GARDENING COOKING DIY

Was it helpful?

Solution

Yes, but you'll need to add the soundex values to the database so you can do a search on them. Otherwise you'll need to pull out every record in the table to parse it through soundex to do the match. Pre-baking is the way to go.

Protip: if you want to be a bit fuzzy, loop through the check cutting off segments of the soundex from the entered value. You'll get back a list of first perfect matches, then near ones, then farther still.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top