SELECT * FROM `db`
WHERE MATCH (city) AGAINST ('south ban' IN BOOLEAN MODE)
SELECT * FROM 'db'
WHERE city LIKE '%south ban%'
我有 2 个查询,一个是使用 Match against,另一个是 LIKE,
当我尝试搜索“南岸”时
Match
如果用户输入south ban则不会返回,但Like
会返回结果
如何改进针对搜索的匹配?
我做了测试,
(country LIKE '%south%' || state LIKE '%south%' || city LIKE '%south%') &&
(country LIKE '%bank%' || state LIKE '%bank%' || city LIKE '%bank%')
MATCH (country, stateprov, city) AGAINST ('south bank*' IN BOOLEAN MODE)
300 万行
匹配 - 69,310 行 - 2.5 秒
LIKE - 67,092 行 - 1.87 秒
为什么 Like 比 match 快?