P
P
pianorockcover2017-07-27 08:16:59
SQL
pianorockcover, 2017-07-27 08:16:59

Is it possible to implement fuzzy word search in MySQL?

Hello! The task is to make a selection from a table of strings in which 2-3 letters may differ from the search criterion. For example, if the user enters "Moscow", the database should, despite the error, find all the lines containing the word "Moscow".

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Roman Mirilaczvili, 2017-07-27
@pianorockcover

According to the description of the problem, it is sufficient to use the Levenshtein distance as a metric for comparison.
Wikipedia

S
Stalker_RED, 2017-07-27
@Stalker_RED

Out of the box there is SOUNDEX() ( tyts , tyts ) but it is only friendly with English, as far as I remember.
You can write a stored procedure to work with the Levenshtein distance, such as .
Well, if everything is serious, then Sphinx .

P
Pavel Ivanov, 2017-07-27
@eastywest

Look from the side of Sphinx, it has the ability to use existing data from MySQL as a source.

X
xmoonlight, 2017-07-27
@xmoonlight

In all seriousness - Stumper API (free).
You can test the search here on your data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question