mysqlsearchelasticsearchinstant

MySQL search with typo


In my MySQL database I have a user table. I need to perform search as you type with typo over the user name field. There are few very old question on this topic. I tested the builtin full text search of mysql but it didn't work as expected (it does not handle typo) [I knew but I tried anyway]. What's my best option? I thought there should be an easy solution nowadays. I'm thinking about replicating the user table on elasticsearch and do the instant search from there, but I'd really like to avoid the syncronization nightmare that this will cause.

Thanks!!


Solution

  • You could use SOUNDEX for mysql. We have tried that but I can say that it does not work that well and it also makes the search a bit slow.

    We Had a similar issue and switched to ES.

    What we did is as follows:

    Apart from this you will also have to create a utility that will create an ES index from the database for first time use.

    And you can also look at Fuzzy Search of ES that will handle typo's

    Also Completion suggester which also supports fuzzy search.