全文用单列mysql搜索

时间:2022-05-08 09:28:44

I am new in MySQL.I was trying table search currently i am using like keyword... . but i like to implement Full Text search method..

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

 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'); 

i was using this code for implement the Mysqlfulltext serach .But i cannot get answer.I was using fulltext search only on Body.. is it possible to use please help me any one

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

1 个解决方案

#1


2  

this will work

这会奏效

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

also see this:

也看到了这个:

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)

#1


2  

this will work

这会奏效

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

also see this:

也看到了这个:

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)