Answer the question
In order to leave comments, you need to log in
How to do the right search?
Good afternoon
The situation is this - there is an online store of nuts
. You need to finish the search to search by part of the word
. For example, the client enters "Cedar" in the search - the result is "nothing found"
But if you enter "cedars" - then everything finds the
Search code -
SELECT `name` FROM `table` WHERE `name` LIKE '%кедров%'
Answer the question
In order to leave comments, you need to log in
after all attempts to force MySQL to search normally fail, you will need to fasten sphinx
Probably a case issue.
Lowercase the word before searching and use the LOWER function in SQL.
SELECT `name` FROM `table` WHERE LOWER(`name`) LIKE '%кедров%'
Well, MB as an option, if the request did not return results, then you can write a method that, instead of the cedar one, will look for cedars, cedars, cedars, ... and the first match has not yet been found
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question