mysql全文索引的坑 MySQL全文索引問題

2021-10-18 21:59:00 字數 1580 閱讀 5549

我有乙個包含以下資料的**文章

mysql> select * from articles;

| id | title | body |

| 1 | mysql tutorial | dbms stands for database ... |

| 2 | how to use mysql well | after you went through a ... |

| 3 | optimizing mysql | in this tutorial we will show ... |

| 4 | 1001 mysql tricks | 1. never run mysqld as root. 2. ... |

| 5 | mysql vs. yoursql | in the following database comparison ... |

| 6 | mysql security | when configured properly, mysql ... |

| 7 | abcd | following things are not upto date |

| 8 | rockon | is the following |

8 rows in set (0.00 sec)

當我把查詢寫成..

mysql> select * from articles where match(`body`) against('database');

| id | title | body |

| 5 | mysql vs. yoursql | in the following database comparison ... |

| 1 | mysql tutorial | dbms stands for database ... |

2 rows in set (0.00 sec)

結果如預期.

但是當我發出查詢時

mysql >select * from articles where match(`body`) against('following' in boolean mode);

empty set (0.00 sec)

為什麼它顯示空集,因為有對應於查詢的記錄.

我身上有全文索引.

mysql> show create table articles\g

*************************** 1. row ***************************

table: articles

create table: create table `articles` (

`id` int(10) unsigned not null auto_increment,

`title` varchar(200) default null,

`body` text,

primary key (`id`),

fulltext key `body` (`body`)

) engine=myisam auto_increment=9 default charset=latin1

1 row in set (0.00 sec)

mysql全文索引

了解 solr 之後 發現全文索引也能做檢索 故了解了下 筆記如下 建立全文索引 alter table table add fulltext index fulltext table 列1 列2 查詢方式 select from table where match 列1 列2 against 查詢...

mysql全文索引

舊版的mysql的全文索引只能用在myisam 的char varchar和text的字段上。不過新版的mysql5.6.24上innodb引擎也加入了全文索引,所以具體資訊要隨時關注官網,create table article id int auto increment not null pri...

MySQL 全文索引

ngram就是一段文字裡邊聯絡的n個字的序列,例如ngram對生日快樂進行分詞 n 1 生 日 快 樂 n 2 生日 日快 快樂 n 3 生日快 日快樂 n 4 生日快樂 learn是資料庫 test是表名 當新增加一條資料時,會把設定全文索引的那個欄位的值進行分詞排序顯示 select from ...