Mysql全文搜索不起作用

时间:2012-11-09 14:08:21

标签: php mysql full-text-search

这是我的数据库代码。问题结果显示0而不是1

  CREATE TABLE IF NOT EXISTS `house_details` (
   `houses_id` int(10) unsigned NOT NULL AUTO_INCREMENT,

   `everything_search` text NOT NULL

    FULLTEXT KEY `everything_search` (`everything_search`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 


    INSERT INTO `house_details` (`everything_search`) VALUES
     ('Good very good new-market Mymenshing Family sourov 4564'),

这是我的数据库查询命令

SELECT * FROM house_details WHERE MATCH (everything_search) AGAINST ('Mymenshing') > 0   ORDER BY `houses_id` DESC LIMIT 0,3 

* ,结果为* MySQL返回一个空结果集(即零行)。 (查询花了0.0013秒)

2 个答案:

答案 0 :(得分:1)

它在布尔模式下适用于我:

SELECT * FROM house_details WHERE MATCH (everything_search) 
AGAINST ('Mymenshing' In Boolean mode) > 0   ORDER BY `houses_id` DESC LIMIT 0,3

看看这里:http://www.sqlfiddle.com/#!2/d4471/6

在进行了一些研究之后,我发现在Mysql中有一个匹配错误的错误:http://bugs.mysql.com/bug.php?id=19583

以下是修复'stopwords'的方法:http://www.nivas.hr/blog/2009/09/15/how-to-disable-mysql-fulltext-stopwords/http://www.sqlfiddle.com/#!2/d4471/6

答案 1 :(得分:0)

我认为你在where子句中不需要>0

        SELECT * FROM house_details 
        WHERE MATCH (everything_search) AGAINST ('Mymenshing')
        ORDER BY `houses_id` DESC LIMIT 0,3 ;