mysql - Loose searching, e.g. such that "htlm" would find "html5" -
i have huge database keywords such html, html5, xhtml, , on. user can search rooms , of merely implemented
[...] name '%keyword%' limit 20; that simple solution start with, not fault-tolerant. , users make lot of faults :3. enhance this, introduce "loose search", meaning if "htlm" returns no or few (less than, say, 10) matches adds "html" , similar list.
the real question is: how do that? 'loose searching' has technical term?
this part of text retrieval , called fuzzy matching or approximate string matching. instance, go google, type "msyql" , recommend "mysql" instead.
here typical approach. start list of valid keywords. yes, place begin. in many text applications, called lexicon.
the search term(s) in list of valid keywords. if not find any, use called "levenshtein distance" (described here) find closest matches. use these in search. if search "levenshtein distance mysql", find implementations of algorithm here.
if have few known misspellings, can solve problem thesaurus. replaces 1 search term other terms might match.
Comments
Post a Comment