在自然模式下mySQL全文搜索不返回部分匹配

时间:2014-08-13 04:51:41

标签: php mysql sql full-text-search

我在自然语言模式下使用mySQL全文搜索,结果未按预期返回。

我有以下查询,我试图在我的数据库中返回所有结果,其中包含' Andrew'在郊区列中的任何方式 - 返回所有结果,包括andrew,即%andrew%。

这是我的疑问:

SELECT dud.suburb, 

MATCH (
dud.suburb
)
AGAINST (
'Andrew*'
) AS location
FROM dr_user AS du
LEFT JOIN dr_user_details AS dud ON ( dud.fk_userid = du.id ) 
LEFT JOIN dr_opening_hours AS dro ON ( dro.fk_userid = du.id ) 
LEFT JOIN dr_user_package AS dup ON ( du.id = dup.fk_userid
AND dup.status =1 ) 
LEFT JOIN dr_package AS dp ON ( dp.id = dup.package_type ) 
LEFT JOIN avail_time_child AS ap ON ( du.id = ap.fk_userid ) 
WHERE 
MATCH (
dud.suburb
)
AGAINST (
'Andrew*'
)
ORDER BY (
location
) desc

我没有结果。 虽然我知道他们是一个名为“圣安德鲁斯”的郊区,但当我更新查询以搜索' andrews'它出现了:

SELECT dud.suburb, 

MATCH (
dud.suburb
)
AGAINST (
'Andrews*'
) AS location
FROM dr_user AS du
LEFT JOIN dr_user_details AS dud ON ( dud.fk_userid = du.id ) 
LEFT JOIN dr_opening_hours AS dro ON ( dro.fk_userid = du.id ) 
LEFT JOIN dr_user_package AS dup ON ( du.id = dup.fk_userid
AND dup.status =1 ) 
LEFT JOIN dr_package AS dp ON ( dp.id = dup.package_type ) 
LEFT JOIN avail_time_child AS ap ON ( du.id = ap.fk_userid ) 
WHERE 
MATCH (
dud.suburb
)
AGAINST (
'Andrews*'
)
ORDER BY (
location
) desc

结果:

suburb  location
ST ANDREWS  9.374254227
ST ANDREWS  9.374254227
ST ANDREWS  9.374254227
ST ANDREWS  9.374254227
ST ANDREWS  9.374254227
ST ANDREWS  9.374254227

我知道运营商不会用自然语言工作,我已尝试过所有组合(*,%),有或没有,没有区别。

任何人都可以帮助解释为什么这些结果在我查询安德鲁'时无法显示?

谢谢,

0 个答案:

没有答案