布尔模式匹配与现有记录不匹配?

时间:2014-02-20 02:07:12

标签: php mysql joomla

所以我有一个看似简单的查询:

SELECT i.*, 
    g.title AS groupname, 
    c.name AS category, 
    v.name AS author, 
    w.name as moderator, 
    u.name AS editor 
FROM `jos_k2_items` as i 
    LEFT JOIN `jos_k2_categories` AS c ON c.id = i.catid 
    LEFT JOIN `jos_viewlevels` AS g ON g.id = i.access 
    LEFT JOIN `jos_users` AS u ON u.id = i.checked_out 
    LEFT JOIN `jos_users` AS v ON v.id = i.created_by 
    LEFT JOIN `jos_users` AS w ON w.id = i.modified_by 
WHERE i.trash=0 
    AND MATCH( i.title ) AGAINST ('+red* +2*' IN BOOLEAN MODE)
ORDER BY i.id DESC

通过管理员界面中的Joomla搜索构建。我正在尝试找到一篇名为RED 2的文章,但它没有返回任何结果。下面是该行的片段:

id  title   alias   catid   published ... trash
===============================================
800 RED 2   red-2   5       1             0

表格上有两个全文索引。第一个位于title列,第二个位于title, introtext, fulltext, extra_fields_search, image_caption, image_credits, video_caption, video_credits, metadesc, metakey

我尝试过的一件事就是重建索引,我使用了以下命令:

REPAIR TABLE `jos_k2_items` QUICK;

1 个答案:

答案 0 :(得分:3)

您尝试匹配短于默认最小全文索引长度3的单词

首先更改该限制

ft_min_word_len = 3

到2或1。

然后重启mysql,并在表上重建索引:

你可以用:

REPAIR TABLE my_table QUICK;