简体   繁体   中英

Mysql full-text search does not work

Here is my database code . the problem result showing 0 instead of 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'),

here is my database query command

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

* and result is * MySQL returned an empty result set (ie zero rows). ( Query took 0.0013 sec )

It works for me in boolean mode:

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

take a look here: http://www.sqlfiddle.com/#!2/d4471/6

after make some reasearch I found that there's a bug with the match-agains in Mysql: http://bugs.mysql.com/bug.php?id=19583

and here is how fix the 'stopwords': http://www.nivas.hr/blog/2009/09/15/how-to-disable-mysql-fulltext-stopwords/http://www.sqlfiddle.com/#!2/d4471/6

I don't think you need >0 in the where clause:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM