Is fulltext search can search for part of a string with MySql + Laravel 5.7

130 Views Asked by At

I need to know how full-text search can be used in Laravel to find records with part of a string in the MySQL table

search string: "mori"

The search result should return a record with: "Memorial Fountain"

Expected outcome: enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

MySQL's FULLTEXT can handle initial strings, but not final or internal strings. That is, this should work:

MATCH(foo) AGAINST('memo*')

This will search for mori, but it will be slow since it need to check each row:

WHERE foo LIKE '%mori%'