MySQL's string matching is precise by design. LIKE
'%shirt%' finds "shirt." It won't find "shrt" or "shrit"
or anything a user actually typed when they meant "shirt."
Handling that in MySQL means regex patterns that grow unwieldy or
full-text search that doesn't rank results by closeness. Usually
it means punting the whole problem to the application layer.
Two VillageSQL extensions bring fuzzy matching into SQL: vsql-trgm for character-level similarity, and vsql-fuzzystrmatch for edit distance and phonetic matching. They solve different problems — knowing which to reach for is half the work. VillageSQL is a drop-in replacement for MySQL — if you're running MySQL, you can swap it in and install extensions without changing your application.
Trigrams: when strings look …
[Read more]