mysql全文索引 fulltext

2021-08-08 18:59:58 字數 678 閱讀 3727

fulltext全文索引

要使用全文索引,不僅需要把某個欄位的索引型別設定為fulltext,還需要修改mysql配置檔案:

[mysqld]

ft_wordlist_charset #表示詞典的字符集

ft_wordlist_file #詞表檔案,每行乙個詞及其詞頻

ft_stopword_file #過濾掉不索引的詞表,一行乙個

ft_min_word_len #加入索引的詞的最小長度,預設為4,為了支援中文單字故可設定為2

如果建立好全文索引之後,我們的表有問題,可以修復一下:

repair table 表名稱 quick
sql中怎麼查詢?

select * from product where

match(name) against('php') limit 0,20;

匹配name字段,這個欄位的索引必須是fulltext

這就是mysql中全文搜尋的簡單介紹。注意這只適合資料量很小的專案。

實際開發中,推薦使用第三方如 sphinx(中文版coreseek)或者elasticsearch

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

我有乙個包含以下資料的 文章 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 o...

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...