| 1 |
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; |
| 2 |
# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX) |
| 3 |
CREATE TABLE articles ( |
| 4 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 5 |
title VARCHAR(200), |
| 6 |
body TEXT, |
| 7 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 8 |
) ENGINE=InnoDB; |
| 9 |
INSERT INTO articles (title, body) VALUES |
| 10 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 11 |
('How To Use MySQL Well','After you went through a ...'), |
| 12 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 13 |
('1001 MySQL Tricks','How to use full-text search engine'), |
| 14 |
('Go MySQL Tricks','How to use full text search engine'); |
| 15 |
SELECT * FROM articles WHERE |
| 16 |
MATCH(title, body) AGAINST('mysql'); |
| 17 |
id title body |
| 18 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 19 |
2 How To Use MySQL Well After you went through a ... |
| 20 |
3 Optimizing MySQL In this tutorial we will show ... |
| 21 |
4 1001 MySQL Tricks How to use full-text search engine |
| 22 |
5 Go MySQL Tricks How to use full text search engine |
| 23 |
SELECT * FROM articles WHERE |
| 24 |
MATCH(title, body) AGAINST('will go'); |
| 25 |
id title body |
| 26 |
# Test plugin parser tokenizer difference |
| 27 |
SELECT * FROM articles WHERE |
| 28 |
MATCH(title, body) AGAINST('full-text'); |
| 29 |
id title body |
| 30 |
4 1001 MySQL Tricks How to use full-text search engine |
| 31 |
SELECT * FROM articles WHERE |
| 32 |
MATCH(title, body) AGAINST('full text'); |
| 33 |
id title body |
| 34 |
5 Go MySQL Tricks How to use full text search engine |
| 35 |
SELECT * FROM articles WHERE |
| 36 |
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 37 |
id title body |
| 38 |
DROP TABLE articles; |
| 39 |
# Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX) |
| 40 |
CREATE TABLE articles ( |
| 41 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 42 |
title VARCHAR(200), |
| 43 |
body TEXT |
| 44 |
) ENGINE=InnoDB; |
| 45 |
INSERT INTO articles (title, body) VALUES |
| 46 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 47 |
('How To Use MySQL Well','After you went through a ...'), |
| 48 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 49 |
('1001 MySQL Tricks','How to use full-text search engine'), |
| 50 |
('Go MySQL Tricks','How to use full text search engine'); |
| 51 |
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; |
| 52 |
Warnings: |
| 53 |
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID |
| 54 |
SELECT * FROM articles WHERE |
| 55 |
MATCH(title, body) AGAINST('mysql'); |
| 56 |
id title body |
| 57 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 58 |
2 How To Use MySQL Well After you went through a ... |
| 59 |
3 Optimizing MySQL In this tutorial we will show ... |
| 60 |
4 1001 MySQL Tricks How to use full-text search engine |
| 61 |
5 Go MySQL Tricks How to use full text search engine |
| 62 |
SELECT * FROM articles WHERE |
| 63 |
MATCH(title, body) AGAINST('will go'); |
| 64 |
id title body |
| 65 |
# Test plugin parser tokenizer difference |
| 66 |
SELECT * FROM articles WHERE |
| 67 |
MATCH(title, body) AGAINST('full-text'); |
| 68 |
id title body |
| 69 |
4 1001 MySQL Tricks How to use full-text search engine |
| 70 |
SELECT * FROM articles WHERE |
| 71 |
MATCH(title, body) AGAINST('full text'); |
| 72 |
id title body |
| 73 |
5 Go MySQL Tricks How to use full text search engine |
| 74 |
SELECT * FROM articles WHERE |
| 75 |
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); |
| 76 |
id title body |
| 77 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 78 |
2 How To Use MySQL Well After you went through a ... |
| 79 |
3 Optimizing MySQL In this tutorial we will show ... |
| 80 |
4 1001 MySQL Tricks How to use full-text search engine |
| 81 |
5 Go MySQL Tricks How to use full text search engine |
| 82 |
SELECT * FROM articles WHERE |
| 83 |
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); |
| 84 |
id title body |
| 85 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 86 |
2 How To Use MySQL Well After you went through a ... |
| 87 |
3 Optimizing MySQL In this tutorial we will show ... |
| 88 |
4 1001 MySQL Tricks How to use full-text search engine |
| 89 |
5 Go MySQL Tricks How to use full text search engine |
| 90 |
SELECT * FROM articles WHERE |
| 91 |
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 92 |
id title body |
| 93 |
DROP TABLE articles; |
| 94 |
# Test Part 3 END |
| 95 |
SET SESSION debug="+d,fts_instrument_use_default_parser"; |
| 96 |
# Test Part 4: Create Index Test with Default/Internal Parser |
| 97 |
CREATE TABLE articles ( |
| 98 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 99 |
title VARCHAR(200), |
| 100 |
body TEXT, |
| 101 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 102 |
) ENGINE=InnoDB; |
| 103 |
INSERT INTO articles (title, body) VALUES |
| 104 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 105 |
('How To Use MySQL Well','After you went through a ...'), |
| 106 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 107 |
('1001 MySQL Tricks','How to use full-text search engine'), |
| 108 |
('Go MySQL Tricks','How to use full text search engine'); |
| 109 |
SELECT * FROM articles WHERE |
| 110 |
MATCH(title, body) AGAINST('mysql'); |
| 111 |
id title body |
| 112 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 113 |
2 How To Use MySQL Well After you went through a ... |
| 114 |
3 Optimizing MySQL In this tutorial we will show ... |
| 115 |
4 1001 MySQL Tricks How to use full-text search engine |
| 116 |
5 Go MySQL Tricks How to use full text search engine |
| 117 |
SELECT * FROM articles WHERE |
| 118 |
MATCH(title, body) AGAINST('will go'); |
| 119 |
id title body |
| 120 |
# Test plugin parser tokenizer difference |
| 121 |
SELECT * FROM articles WHERE |
| 122 |
MATCH(title, body) AGAINST('full-text'); |
| 123 |
id title body |
| 124 |
4 1001 MySQL Tricks How to use full-text search engine |
| 125 |
5 Go MySQL Tricks How to use full text search engine |
| 126 |
SELECT * FROM articles WHERE |
| 127 |
MATCH(title, body) AGAINST('full text'); |
| 128 |
id title body |
| 129 |
4 1001 MySQL Tricks How to use full-text search engine |
| 130 |
5 Go MySQL Tricks How to use full text search engine |
| 131 |
SELECT * FROM articles WHERE |
| 132 |
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 133 |
id title body |
| 134 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 135 |
DROP TABLE articles; |
| 136 |
# Test Part 5: Row Merge Create Index Test with Default/Internal Parser |
| 137 |
CREATE TABLE articles ( |
| 138 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 139 |
title VARCHAR(200), |
| 140 |
body TEXT |
| 141 |
) ENGINE=InnoDB; |
| 142 |
INSERT INTO articles (title, body) VALUES |
| 143 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 144 |
('How To Use MySQL Well','After you went through a ...'), |
| 145 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 146 |
('1001 MySQL Tricks','How to use full-text search engine'), |
| 147 |
('Go MySQL Tricks','How to use full text search engine'); |
| 148 |
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; |
| 149 |
Warnings: |
| 150 |
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID |
| 151 |
SELECT * FROM articles WHERE |
| 152 |
MATCH(title, body) AGAINST('mysql'); |
| 153 |
id title body |
| 154 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 155 |
2 How To Use MySQL Well After you went through a ... |
| 156 |
3 Optimizing MySQL In this tutorial we will show ... |
| 157 |
4 1001 MySQL Tricks How to use full-text search engine |
| 158 |
5 Go MySQL Tricks How to use full text search engine |
| 159 |
SELECT * FROM articles WHERE |
| 160 |
MATCH(title, body) AGAINST('will go'); |
| 161 |
id title body |
| 162 |
# Test plugin parser tokenizer difference |
| 163 |
SELECT * FROM articles WHERE |
| 164 |
MATCH(title, body) AGAINST('full-text'); |
| 165 |
id title body |
| 166 |
4 1001 MySQL Tricks How to use full-text search engine |
| 167 |
5 Go MySQL Tricks How to use full text search engine |
| 168 |
SELECT * FROM articles WHERE |
| 169 |
MATCH(title, body) AGAINST('full text'); |
| 170 |
id title body |
| 171 |
4 1001 MySQL Tricks How to use full-text search engine |
| 172 |
5 Go MySQL Tricks How to use full text search engine |
| 173 |
SELECT * FROM articles WHERE |
| 174 |
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 175 |
id title body |
| 176 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 177 |
DROP TABLE articles; |
| 178 |
# Test Part 6: Test Query Parser with Default/Internal Parser |
| 179 |
SET GLOBAL innodb_ft_enable_diag_print = 1; |
| 180 |
CREATE TABLE articles ( |
| 181 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 182 |
title VARCHAR(200), |
| 183 |
body TEXT, |
| 184 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 185 |
) ENGINE=InnoDB; |
| 186 |
INSERT INTO articles (title, body) VALUES |
| 187 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 188 |
('MySQL Tutorial','DBMS stands for MySQL good one DataBase ...'), |
| 189 |
('How To Use MySQL Well','After you went through a ...'), |
| 190 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 191 |
('1001 MySQL Tricks','How to use full-text search engine'); |
| 192 |
SELECT * FROM articles WHERE |
| 193 |
MATCH(title, body) AGAINST('+mysql -database' IN BOOLEAN MODE); |
| 194 |
id title body |
| 195 |
3 How To Use MySQL Well After you went through a ... |
| 196 |
4 Optimizing MySQL In this tutorial we will show ... |
| 197 |
5 1001 MySQL Tricks How to use full-text search engine |
| 198 |
SELECT * FROM articles WHERE |
| 199 |
MATCH(title, body) AGAINST('>mysql <database ~search' IN BOOLEAN MODE); |
| 200 |
id title body |
| 201 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 202 |
2 MySQL Tutorial DBMS stands for MySQL good one DataBase ... |
| 203 |
3 How To Use MySQL Well After you went through a ... |
| 204 |
4 Optimizing MySQL In this tutorial we will show ... |
| 205 |
5 1001 MySQL Tricks How to use full-text search engine |
| 206 |
SELECT * FROM articles WHERE |
| 207 |
MATCH(title, body) AGAINST('+(mysql database) -engine' IN BOOLEAN MODE); |
| 208 |
id title body |
| 209 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 210 |
2 MySQL Tutorial DBMS stands for MySQL good one DataBase ... |
| 211 |
3 How To Use MySQL Well After you went through a ... |
| 212 |
4 Optimizing MySQL In this tutorial we will show ... |
| 213 |
SELECT * FROM articles WHERE |
| 214 |
MATCH(title, body) AGAINST('+(mysql database -engine' IN BOOLEAN MODE); |
| 215 |
id title body |
| 216 |
SELECT * FROM articles WHERE |
| 217 |
MATCH(title, body) AGAINST('"mysql"' IN BOOLEAN MODE); |
| 218 |
id title body |
| 219 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 220 |
2 MySQL Tutorial DBMS stands for MySQL good one DataBase ... |
| 221 |
3 How To Use MySQL Well After you went through a ... |
| 222 |
4 Optimizing MySQL In this tutorial we will show ... |
| 223 |
5 1001 MySQL Tricks How to use full-text search engine |
| 224 |
SELECT * FROM articles WHERE |
| 225 |
MATCH(title, body) AGAINST('"for mysql"' IN BOOLEAN MODE); |
| 226 |
id title body |
| 227 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 228 |
2 MySQL Tutorial DBMS stands for MySQL good one DataBase ... |
| 229 |
3 How To Use MySQL Well After you went through a ... |
| 230 |
4 Optimizing MySQL In this tutorial we will show ... |
| 231 |
5 1001 MySQL Tricks How to use full-text search engine |
| 232 |
SELECT * FROM articles WHERE |
| 233 |
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 234 |
id title body |
| 235 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 236 |
SELECT * FROM articles WHERE |
| 237 |
MATCH(title, body) AGAINST('"full text search"' IN BOOLEAN MODE); |
| 238 |
id title body |
| 239 |
5 1001 MySQL Tricks How to use full-text search engine |
| 240 |
SELECT * FROM articles WHERE |
| 241 |
MATCH(title, body) AGAINST('"full text search engine"' IN BOOLEAN MODE); |
| 242 |
id title body |
| 243 |
5 1001 MySQL Tricks How to use full-text search engine |
| 244 |
SELECT * FROM articles WHERE |
| 245 |
MATCH(title, body) AGAINST('+"dbms stands" -good' IN BOOLEAN MODE); |
| 246 |
id title body |
| 247 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 248 |
SELECT * FROM articles WHERE |
| 249 |
MATCH(title, body) AGAINST('+("dbms stands") -good' IN BOOLEAN MODE); |
| 250 |
id title body |
| 251 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 252 |
SELECT * FROM articles WHERE |
| 253 |
MATCH(title, body) AGAINST('+("dbms stands" search) -good' IN BOOLEAN MODE); |
| 254 |
id title body |
| 255 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 256 |
5 1001 MySQL Tricks How to use full-text search engine |
| 257 |
SELECT * FROM articles WHERE |
| 258 |
MATCH(title, body) AGAINST('+("dbms stands" "full text") -good' IN BOOLEAN MODE); |
| 259 |
id title body |
| 260 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 261 |
5 1001 MySQL Tricks How to use full-text search engine |
| 262 |
SELECT * FROM articles WHERE |
| 263 |
MATCH(title, body) AGAINST('("msyql database")@3' IN BOOLEAN MODE); |
| 264 |
id title body |
| 265 |
DROP TABLE articles; |
| 266 |
SET NAMES utf8; |
| 267 |
Warnings: |
| 268 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 269 |
# Test Part 7: Test Different Charset |
| 270 |
CREATE TABLE articles ( |
| 271 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 272 |
title VARCHAR(200), |
| 273 |
body TEXT, |
| 274 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 275 |
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci; |
| 276 |
INSERT INTO articles (title, body) VALUES |
| 277 |
('数据库 是 数据 的 结构化 集合','它 可以 是 任何 东西'), |
| 278 |
('从 简单 的 购物清单 到 画展','或 企业网络 中 的 海量信息'), |
| 279 |
('要 想 将 数据 添加 到 数据库','或 访问、处理 计算机 数据库 中 保存 的 数据'), |
| 280 |
('需要 使用 数据库 管理系统','计算机 是 处理 大量 数据 的 理想 工具'); |
| 281 |
SELECT * FROM articles WHERE |
| 282 |
MATCH(title, body) AGAINST('数据库'); |
| 283 |
id title body |
| 284 |
1 数据库 是 数据 的 结构化 集合 它 可以 是 任何 东西 |
| 285 |
3 要 想 将 数据 添加 到 数据库 或 访问、处理 计算机 数据库 中 保存 的 数据 |
| 286 |
4 需要 使用 数据库 管理系统 计算机 是 处理 大量 数据 的 理想 工具 |
| 287 |
SELECT * FROM articles WHERE |
| 288 |
MATCH(title, body) AGAINST('数据'); |
| 289 |
id title body |
| 290 |
SELECT * FROM articles WHERE |
| 291 |
MATCH(title, body) AGAINST('数据*'); |
| 292 |
id title body |
| 293 |
1 数据库 是 数据 的 结构化 集合 它 可以 是 任何 东西 |
| 294 |
3 要 想 将 数据 添加 到 数据库 或 访问、处理 计算机 数据库 中 保存 的 数据 |
| 295 |
4 需要 使用 数据库 管理系统 计算机 是 处理 大量 数据 的 理想 工具 |
| 296 |
SELECT * FROM articles WHERE |
| 297 |
MATCH(title, body) AGAINST('+数据库 -计算机'); |
| 298 |
id title body |
| 299 |
1 数据库 是 数据 的 结构化 集合 它 可以 是 任何 东西 |
| 300 |
SELECT * FROM articles WHERE |
| 301 |
MATCH(title, body) AGAINST('"计算机 数据库"' IN BOOLEAN MODE); |
| 302 |
id title body |
| 303 |
3 要 想 将 数据 添加 到 数据库 或 访问、处理 计算机 数据库 中 保存 的 数据 |
| 304 |
DROP TABLE articles; |
| 305 |
SET GLOBAL innodb_ft_enable_diag_print = 0; |
| 306 |
SET SESSION debug="-d,fts_instrument_use_default_parser"; |
| 307 |
# Test Part 9:# Abort the operation in dict_create_index_step |
| 308 |
CREATE TABLE articles ( |
| 309 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 310 |
title VARCHAR(200), |
| 311 |
body TEXT, |
| 312 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 313 |
) ENGINE=InnoDB; |
| 314 |
SET SESSION debug="+d,ib_dict_create_index_tree_fail"; |
| 315 |
CREATE FULLTEXT INDEX idx ON articles(body); |
| 316 |
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space |
| 317 |
SET SESSION debug="-d,ib_dict_create_index_tree_fail"; |
| 318 |
DROP TABLE articles; |
| 319 |
UNINSTALL PLUGIN simple_parser; |