MySQL 结巴中文分词插件 SqlJieba
『关键词』
MySQL, 插件(Plugin), 中文分词, 结巴分词(Jieba), 全文检索(Full-Text), SqlJieba
使用方法:
mysql> create database sqljieba;
Query OK, 1 row affected (0.04 sec)
mysql> use sqljieba;
Database changed
mysql> CREATE TABLE t (c VARCHAR(255), FULLTEXT (c) WITH PARSER sqljieba ) ENGINE=MyISAM;
Query OK, 0 rows affected (0.08 sec)
mysql> INSERT INTO t VALUES
-> ('这是一个简单测试'),
-> ('上海 广州 北京'),
-> ('泰山 黄山 嵩山');
Query OK, 3 rows affected (0.06 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> SELECT MATCH(c) AGAINST('上海') FROM t;
+----------------------------+
| MATCH(c) AGAINST('上海') |
+----------------------------+
| 0 |
| 0.5647933483123779 |
| 0 |
+----------------------------+
3 rows in set (0.04 sec)