Basically I have a database full of entries that will be searchable with a script. Because of the likelyhood of slight misspellings and whatnot, I've also had the metaphone value of each entry in another field on the database as well, so that it looks like:
Entry Metaphone
==== ========
blah BL
Anyways, the search I have thought of would take the user's search string, metaphone it, and loop through the whole database comparing the string and if the levenshtein value is below a certain number, it will display it as a result....
Is this efficient? It seems inefficient to me to loop through the whole thing, but other solutions don't seem well enough. Originally I thought of cutting the string down to a few letters and doing a LIKE query on the database, but that either ends up with two many results or none if the word entered isn't one fo the first in the database's metaphone entry.
Any other ideas on how to combine metaphone values and levenshtein in a good smart search?