Awesome q2a theme

How to do a proper search?

0 like 0 dislike
31 views
Good day
The situation is this - there is an Internet store of nuts
You need to use third party search to look for parts of words
For example, the customer enters in the search "Pine" - the result is "nothing found"
But if you type "cedars" - that everyone finds
Search code -
SELECT `name` FROM `table` WHERE `name` LIKE '%cedar%'

The question is - is there any possibility in SQL to search for partial words?
by | 31 views

3 Answers

0 like 0 dislike
after all attempts to force MySQL to look for a normal fail, you will need to tie sphinx
by
0 like 0 dislike
Probably a problem with character case.
Before searching bring the word to lower case in SQL and use the function LOWER.

SELECT `name` FROM `table` WHERE LOWER(`name`) LIKE '%cedar%'
by
0 like 0 dislike
Well MB as an option if the query returned no results then we can write a method which instead cedar will look for Kedrovy, cedars, kedro, ... and until first match is found
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
asked Apr 13, 2019 by LyoSU
0 like 0 dislike
3 answers
asked Apr 11, 2019 by kovalenko_jul_s
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users