Keyword Searches using wildcards and fuzzy techniques in PHP

Associate
Joined
27 Feb 2003
Posts
190
Location
North East
Hi,

I need to perform a search on a mysql table that holds details of job vacancies. the table has fields such as job title and job description.

Now I need to use a fuzzy search technique to allow the user to enter the incorrect spelling of job titles for example. I've looked at using the "like %jobTitle%" in the sql query but i need something a bit more meaty!

I've been looking at using something like the levenshtein function within php (http://www.w3schools.com/php/func_string_levenshtein.asp) but I'm not sure on how to incorporate it into my form.

If anyone could help me out I'd be very grateful!:)

Thanks

Paul
 
You could first search the db for the contents of the user field, then if there are no matches, search again when comparing the entered string to possible values (using levenshtein above a certain threshold... e.g. doctor -> doktor is okay... spanner -> doctor isn't).

Did that make sense? O_o

EDIT - http://codewalkers.com/tutorials/46/26.html
 
Back
Top Bottom