How do I do autocompletion via MySQL FULLTEXT index?
There is a table, for example tag
:
I do a search via match against
. Here is the request:
SELECT id, name FROM tag WHERE MATCH (name) AGAINST (:search WITH QUERY EXPANSION)
Here is the result if you search for the word chevrolet
:
Question:
How do I make a search not entirely for the word chevrolet
, but only for a part of the word, for example: chevr
?
If the word is not fully written, then match against
does not give the result. Is there anything other than LIKE?
1
Author: Valeriu Vodnicear, 2018-04-12
1 answers
This question was already on StackOverflow, MySQL full-text search-search by the first letter I just didn't search correctly. The solution is:
SELECT id, name FROM tag WHERE MATCH (name) AGAINST ('+chevr*' IN BOOLEAN MODE)
1
Author: Valeriu Vodnicear, 2018-04-12 09:05:01