D
D
Dmitry Morozov2018-04-04 15:22:06
MySQL
Dmitry Morozov, 2018-04-04 15:22:06

How to search MySQL for numbers starting with 0 (full text search)?

Base with users and addresses of residence. Some apartments are entered as "p06"
This query does not find anything

SELECT username, address FROM base WHERE MATCH (username,address) AGAINST ('+Энтуз* +36 +06' IN BOOLEAN MODE);

Such finds Enthusiasts highway, 36, kv.p06
SELECT username, address FROM base WHERE MATCH (username,address) AGAINST ('+Энтуз* +36 +п06' IN BOOLEAN MODE);

And such a request finds only Entuziastov shosse, 36, apt. 6
SELECT username, address FROM base WHERE MATCH (username,address) AGAINST ('+Энтуз* +36 +6' IN BOOLEAN MODE);

Such a request finds Entuziastov shosse, 36, apt. 16
SELECT username, address FROM base WHERE MATCH (username,address) AGAINST ('+Энтуз* +36 +16' IN BOOLEAN MODE);

ps ft_min_word_len = 1
The task is to find both options for the query "+Entuz* +36 +6"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
justpusher, 2018-04-12
@justpusher

Make an additional field that participates in the search, but is not displayed to the user.
When inserting a record with "apt. p06" enter "6 06" in the additional field.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question