2

我是 MySQL 的新手。我正在尝试表搜索,目前我正在使用 like 关键字...。但我喜欢实现全文搜索方法..

 CREATE TABLE art(
   id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
    body TEXT,
   FULLTEXT (body)
   ) ENGINE=MyISAM




INSERT INTO `art` (`id` , `body`) VALUES
(1,  'php coding and soluton'),
(2,  'java coding and soluton'),
(3, 'DBMS stands for DataBase ...'),
(4, 'After you went through a ...'),
(5, 'In this tutorial we will show ...'),
(6,  '1. Never run mysqld as root. 2. ...'),
(7, 'In the following database comparison ...'),
(8,  'When configured properly, MySQL ...');


SELECT * FROM art 
WHERE MATCH (body) AGAINST ('database'); 

我正在使用此代码来实现 Mysqlfulltext serach 。但我无法得到答案。我只在 Body 上使用全文搜索 .. 是否可以使用请帮助我任何人

4

1 回答 1

2

这会起作用

select * from art where MATCH (body) AGAINST ('database')>0;

还看到这个:

mysql> select MATCH (body) AGAINST ('database') from art;
+-----------------------------------+
| MATCH (body) AGAINST ('database') |
+-----------------------------------+
|                                 0 |
|                                 0 |
|                  1.06197416782379 |
|                                 0 |
|                                 0 |
|                                 0 |
|                  1.07391238212585 |
|                                 0 |
+-----------------------------------+
8 rows in set (0.00 sec)
于 2012-06-12T19:12:07.800 回答