MySQL FullText Search
條件
engine : MyISAM
column : CHAR, VARCHAR, TEXT
config : ft_min_word_len
建立資料庫
CREATE TABLE t
(
content CHAR(255),
FULLTEXT INDEX (content) WITH PARSER my_parser
) ENGINE=MyISAM;

ALTER TABLE t A...
檢索模式
Natural Language (Stopwords)
BOOLEAN (+ - ~ > <)
中文檢索
(MySQL 預設不支援中文檢索)
tokenizer + text encode (base64, unicode,
urlencode)
mysql plug-in (mecab(詞庫)、bigram(N-gram))
測試
SELECT * FROM t WHERE content LIKE '%台北%';
4000筆 : 0.060 s
12000筆 : 0.15 s
SELECT * FROM t WHERE MATCH(content) AGAINST...
Reference
MySQL :: MySQL 5.0 Reference Manual :: 12.9 Full-Text Search Functions
http://dev.mysql.com/doc/refman/5.0/en/fu...
My sql fulltext search
Upcoming SlideShare
Loading in...5
×

My sql fulltext search

818

Published on

Published in: Technology, Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
818
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

My sql fulltext search

  1. 1. MySQL FullText Search
  2. 2. 條件 engine : MyISAM column : CHAR, VARCHAR, TEXT config : ft_min_word_len
  3. 3. 建立資料庫 CREATE TABLE t ( content CHAR(255), FULLTEXT INDEX (content) WITH PARSER my_parser ) ENGINE=MyISAM; ALTER TABLE t ADD FULLTEXT INDEX (content) WITH PARSER my_parser;
  4. 4. 檢索模式 Natural Language (Stopwords) BOOLEAN (+ - ~ > <)
  5. 5. 中文檢索 (MySQL 預設不支援中文檢索) tokenizer + text encode (base64, unicode, urlencode) mysql plug-in (mecab(詞庫)、bigram(N-gram))
  6. 6. 測試 SELECT * FROM t WHERE content LIKE '%台北%'; 4000筆 : 0.060 s 12000筆 : 0.15 s SELECT * FROM t WHERE MATCH(content) AGAINST('+" 台北"' IN BOOLEAN MODE); 4000筆 : 0.016 s 12000筆 : 0.04 s
  7. 7. Reference MySQL :: MySQL 5.0 Reference Manual :: 12.9 Full-Text Search Functions http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html y-ken/mysqlftppc-mecab https://github.com/y-ken/mysqlftppc-mecab 使用 N-gram 演算來支援 MySQL 中文全文檢索 https://github.com/y-ken/mysqlftppc-bigram/blob/master/INSTALL FullText search of MySQL supported for SQLAlchemy https://github.com/mengzhuo/sqlalchemy-fulltext-search
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×