C
C
chelkaz2017-02-19 09:20:22
MySQL
chelkaz, 2017-02-19 09:20:22

Is it possible to do an inaccurate search in a MySql field and how to do it?

For example, there is a field that stores data as a full address string:

Ящерицын Росад снт Борисово деревня Серпуховский район Московская область

and for example, it will also be:
Росад деревня Другой район Другая область
How and what to do the search, if, for example, the user searches for:
росад москва
or
росад мос обл
After all, it is important here that this is the Moscow region, but the request may not contain an explicit indication of the full word
, but only a part or similar. For example , Rosad Moscow , although in the base field the word Moscow and not Moscow But this is as accurate as possible and in fact the search should then give this answer.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaly, 2017-02-19
@vshvydky

I will rephrase my answer so that the moderators do not itch. It is stupid to store the address like this, you need to store it adequately, for example, you should look at fias, a site like fias.nalog.ru
Store adequately, this is to go read about 3rd normal form.

T
totosarg, 2017-02-19
@totosarg

In general, of course, everything is strange for you, but, answering your question, there is such a LIKE operator. Lets search for similar glory, looks something like this:
The percent sign is a wildcard. But in your case it is better not to do so. Read about database normalization .

P
Puma Thailand, 2017-02-19
@opium

sphinx and solr can do it all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question