1INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; 2# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX) 3CREATE TABLE articles ( 4id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 5title VARCHAR(200), 6body TEXT, 7body1 TEXT, 8body2 TEXT, 9body3 TEXT, 10FULLTEXT (title, body) WITH PARSER simple_parser, 11FULLTEXT (title, body1) WITH PARSER simple_parser, 12FULLTEXT (body3) 13) ENGINE=InnoDB; 14INSERT INTO articles (title, body,body1,body2,body3) VALUES 15('MySQL Tutorial','DBMS stands for MySQL DataBase ...','row1col4','row1col5','row1col5'), 16('How To Use MySQL Well','After you went through a ...','row2col4','row2col5','row2col5'), 17('Optimizing MySQL','In this tutorial we will show ...','row3col4','row3col5','row3col5 for'), 18('1001 MySQL Tricks','How to use full-text search engine','row4col4','row4col5','row4col5'), 19('Go MySQL Tricks','How to use full text search engine','row5col4 this','row5col5','row5col5'); 20ALTER TABLE articles ADD FULLTEXT INDEX (body1,body2) WITH PARSER simple_parser; 21ALTER TABLE articles ADD FULLTEXT INDEX (body2,body3); 22ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser; 23ANALYZE TABLE articles; 24Table Op Msg_type Msg_text 25test.articles analyze status OK 26SELECT 27PLUGIN_NAME, PLUGIN_STATUS, PLUGIN_TYPE, 28PLUGIN_LIBRARY 29FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%simple_parser%'; 30PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE PLUGIN_LIBRARY 31simple_parser ACTIVE FTPARSER mypluglib.so 32INSERT INTO articles (title, body,body1,body2,body3) VALUES (NULL,NULL,NULL,NULL,NULL); 33SELECT * FROM articles WHERE 34MATCH(title, body) AGAINST('mysql'); 35id title body body1 body2 body3 361 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 372 How To Use MySQL Well After you went through a ... row2col4 row2col5 row2col5 383 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 394 1001 MySQL Tricks How to use full-text search engine row4col4 row4col5 row4col5 405 Go MySQL Tricks How to use full text search engine row5col4 this row5col5 row5col5 41SELECT * FROM articles WHERE 42MATCH(title, body) AGAINST('dbms' WITH QUERY EXPANSION); 43id title body body1 body2 body3 441 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 453 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 462 How To Use MySQL Well After you went through a ... row2col4 row2col5 row2col5 474 1001 MySQL Tricks How to use full-text search engine row4col4 row4col5 row4col5 485 Go MySQL Tricks How to use full text search engine row5col4 this row5col5 row5col5 49SELECT * FROM articles WHERE 50MATCH(title, body1) AGAINST('row1col4'); 51id title body body1 body2 body3 521 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 53SELECT * FROM articles WHERE 54MATCH(title, body) AGAINST('row5col4' WITH QUERY EXPANSION); 55id title body body1 body2 body3 56SELECT * FROM articles WHERE 57MATCH(body1, body2) AGAINST('row3col4'); 58id title body body1 body2 body3 593 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 60SELECT * FROM articles WHERE 61MATCH(body) AGAINST('well' WITH QUERY EXPANSION); 62id title body body1 body2 body3 63SELECT * FROM articles WHERE 64MATCH(title, body) AGAINST('will go'); 65id title body body1 body2 body3 66SELECT * FROM articles WHERE 67MATCH(title, body) AGAINST('this'); 68id title body body1 body2 body3 69SELECT * FROM articles WHERE 70MATCH(title, body) AGAINST('for'); 71id title body body1 body2 body3 72SELECT * FROM articles WHERE 73MATCH(body1, body2) AGAINST('this'); 74id title body body1 body2 body3 75SELECT * FROM articles WHERE 76MATCH(body) AGAINST('this'); 77id title body body1 body2 body3 78# Test plugin parser tokenizer difference 79SELECT * FROM articles WHERE 80MATCH(title, body) AGAINST('full-text'); 81id title body body1 body2 body3 824 1001 MySQL Tricks How to use full-text search engine row4col4 row4col5 row4col5 83SELECT * FROM articles WHERE 84MATCH(title, body) AGAINST('full text'); 85id title body body1 body2 body3 865 Go MySQL Tricks How to use full text search engine row5col4 this row5col5 row5col5 87SELECT * FROM articles WHERE 88MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); 89id title body body1 body2 body3 90SELECT * FROM articles WHERE 91MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); 92id title body body1 body2 body3 93START TRANSACTION; 94INSERT INTO articles (title, body,body1,body2,body3) VALUES 95('latest Tutorial','transactional properties tests ...','row6col4','row6col5','row6col5'), 96('certification guide','all mysql exams tests ...','row7col4','row7col5','row7col5'); 97SELECT * FROM articles WHERE 98MATCH(title, body) AGAINST('mysql'); 99id title body body1 body2 body3 1001 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 1012 How To Use MySQL Well After you went through a ... row2col4 row2col5 row2col5 1023 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 1034 1001 MySQL Tricks How to use full-text search engine row4col4 row4col5 row4col5 1045 Go MySQL Tricks How to use full text search engine row5col4 this row5col5 row5col5 105SELECT * FROM articles WHERE 106MATCH(title, body) AGAINST('Tutorial'); 107id title body body1 body2 body3 1081 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 1093 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 110SELECT * FROM articles WHERE 111MATCH(title, body) AGAINST('guide'); 112id title body body1 body2 body3 113SELECT * FROM articles WHERE 114MATCH(title, body) AGAINST('tests'); 115id title body body1 body2 body3 116SELECT * FROM articles WHERE 117MATCH(title, body1) AGAINST('row6col4'); 118id title body body1 body2 body3 119SELECT * FROM articles WHERE 120MATCH(body1,body2) AGAINST('row7col5'); 121id title body body1 body2 body3 122SELECT * FROM articles WHERE id > 5; 123id title body body1 body2 body3 1246 NULL NULL NULL NULL NULL 1257 latest Tutorial transactional properties tests ... row6col4 row6col5 row6col5 1268 certification guide all mysql exams tests ... row7col4 row7col5 row7col5 127ROLLBACK; 128SELECT * FROM articles WHERE 129MATCH(title, body) AGAINST('mysql'); 130id title body body1 body2 body3 1311 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 1322 How To Use MySQL Well After you went through a ... row2col4 row2col5 row2col5 1333 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 1344 1001 MySQL Tricks How to use full-text search engine row4col4 row4col5 row4col5 1355 Go MySQL Tricks How to use full text search engine row5col4 this row5col5 row5col5 136SELECT * FROM articles WHERE 137MATCH(title, body) AGAINST('Tutorial'); 138id title body body1 body2 body3 1391 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 1403 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 141SELECT * FROM articles WHERE 142MATCH(title, body) AGAINST('guide'); 143id title body body1 body2 body3 144SELECT * FROM articles WHERE 145MATCH(title, body) AGAINST('tests'); 146id title body body1 body2 body3 147SELECT * FROM articles WHERE 148MATCH(title, body1) AGAINST('row6col4'); 149id title body body1 body2 body3 150SELECT * FROM articles WHERE 151MATCH(body1,body2) AGAINST('row7col5'); 152id title body body1 body2 body3 153START TRANSACTION; 154INSERT INTO articles (title, body,body1,body2,body3) VALUES 155('latest Tutorial','transactional properties tests ...','row6col4','row6col5','row6col5'); 156COMMIT; 157SELECT * FROM articles WHERE 158MATCH(title, body) AGAINST('mysql'); 159id title body body1 body2 body3 1601 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 1612 How To Use MySQL Well After you went through a ... row2col4 row2col5 row2col5 1623 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 1634 1001 MySQL Tricks How to use full-text search engine row4col4 row4col5 row4col5 1645 Go MySQL Tricks How to use full text search engine row5col4 this row5col5 row5col5 165SELECT * FROM articles WHERE 166MATCH(title, body) AGAINST('Tutorial'); 167id title body body1 body2 body3 1681 MySQL Tutorial DBMS stands for MySQL DataBase ... row1col4 row1col5 row1col5 1693 Optimizing MySQL In this tutorial we will show ... row3col4 row3col5 row3col5 for 1709 latest Tutorial transactional properties tests ... row6col4 row6col5 row6col5 171SELECT * FROM articles WHERE 172MATCH(title, body) AGAINST('guide'); 173id title body body1 body2 body3 174SELECT * FROM articles WHERE 175MATCH(title, body) AGAINST('tests'); 176id title body body1 body2 body3 1779 latest Tutorial transactional properties tests ... row6col4 row6col5 row6col5 178SELECT * FROM articles WHERE 179MATCH(body) AGAINST('tests'); 180id title body body1 body2 body3 1819 latest Tutorial transactional properties tests ... row6col4 row6col5 row6col5 182SELECT * FROM articles WHERE 183MATCH(title, body1) AGAINST('row6col4'); 184id title body body1 body2 body3 1859 latest Tutorial transactional properties tests ... row6col4 row6col5 row6col5 186SELECT * FROM articles WHERE 187MATCH(body1,body2) AGAINST('row7col5'); 188id title body body1 body2 body3 189SELECT COUNT(*) FROM articles; 190COUNT(*) 1917 192ALTER TABLE articles ADD COLUMN col_test VARCHAR(100) DEFAULT 'check add drop column'; 193SELECT COUNT(*) FROM articles WHERE col_test = 'check add drop column'; 194COUNT(*) 1957 196ALTER TABLE articles ADD FULLTEXT INDEX `idx_add` (col_test) WITH PARSER simple_parser; 197INSERT INTO articles (title, body,body1,body2,body3,col_test) VALUES 198('value','value','value','value','value','value'); 199SELECT COUNT(*) AS score FROM articles WHERE 200MATCH(col_test) AGAINST('check'); 201score 2027 203SELECT COUNT(*) AS score FROM articles WHERE 204MATCH(col_test) AGAINST('value'); 205score 2061 207ALTER TABLE articles DROP COLUMN col_test; 208SELECT * FROM articles WHERE 209MATCH(title, body1) AGAINST('row6col4'); 210id title body body1 body2 body3 2119 latest Tutorial transactional properties tests ... row6col4 row6col5 row6col5 212SELECT * FROM articles WHERE 213MATCH(body1,body2) AGAINST('row7col5'); 214id title body body1 body2 body3 215DROP TABLE articles; 216SET NAMES UTF8; 217Warnings: 218Warning 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. 219DROP TABLE IF EXISTS t1; 220CREATE TABLE t1 ( 221id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 222a VARCHAR(200), 223b TEXT, 224FULLTEXT (b) WITH PARSER simple_parser 225) CHARACTER SET = UTF8,ENGINE = InnoDB; 226Warnings: 227Warning 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. 228INSERT INTO t1 (a,b) VALUES 229('MySQL from Tutorial','DBMS stands for DataBase ...') , 230('when To Use MySQL Well','After that you went through a ...'), 231('where will Optimizing MySQL','what In this tutorial we will show ...'), 232('Я могу есть стекло', 'оно мне Mне вредит'), 233('Μπορῶ νὰ φάω σπασμένα' ,'γυαλιὰ χωρὶς νὰ πάθω τίποτα'), 234('Sævör grét', 'áðan því úlpan var ónýt'); 235CREATE FULLTEXT INDEX idx on t1 (a,b) WITH PARSER simple_parser; 236INSERT INTO t1 (a,b) VALUES 237('adding record using session 1','for verifying multiple concurrent transactions'), 238('Мога да ям стъкло', 'то Mне ми вреди'); 239SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); 240id a b 241SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Mне'); 242id a b 2434 Я могу есть стекло оно мне Mне вредит 2448 Мога да ям стъкло то Mне ми вреди 245SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('могу'); 246id a b 2474 Я могу есть стекло оно мне Mне вредит 248SELECT * FROM t1 WHERE MATCH (b) AGAINST ('áðan'); 249id a b 2506 Sævör grét áðan því úlpan var ónýt 251SELECT * FROM t1 WHERE MATCH (b) AGAINST ('áðan') OR MATCH (a,b) AGAINST ('Mне могу'); 252id a b 2534 Я могу есть стекло оно мне Mне вредит 2546 Sævör grét áðan því úlpan var ónýt 2558 Мога да ям стъкло то Mне ми вреди 256SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('стъкло'); 257id a b 2588 Мога да ям стъкло то Mне ми вреди 259SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); 260id a b 261SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('for'); 262id a b 263DROP TABLE t1; 264SELECT @@innodb_ft_min_token_size,@@innodb_ft_max_token_size; 265@@innodb_ft_min_token_size @@innodb_ft_max_token_size 2663 84 267CREATE TABLE t1 ( 268id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 269a VARCHAR(200), 270b TEXT, 271FULLTEXT (b) WITH PARSER simple_parser 272) CHARACTER SET = UTF8,ENGINE = InnoDB; 273Warnings: 274Warning 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. 275INSERT INTO t1 (a,b) VALUES 276('MySQL from Tutorial','DBMS stands for DataBase ...') , 277('when To Use MySQL Well','After that you went through a ...'), 278('where will Optimizing MySQL','what In this tutorial we will show ...'), 279('Я могу есть стекло', 'оно мне Mне вредит'), 280('Μπορῶ νὰ φάω σπασμένα' ,'γυαλιὰ χωρὶς νὰ πάθω τίποτα'), 281('Sævör grét', 'áðan því úlpan var ónýt'); 282CREATE FULLTEXT INDEX idx on t1 (a,b) WITH PARSER simple_parser; 283INSERT INTO t1 (a,b) VALUES 284('adding record using session 1','for verifying multiple concurrent transactions'), 285('Мога да ям стъкло', 'то Mне ми вреди'),(NULL,NULL); 286# restart:--innodb_ft_min_token_size=5 --innodb_ft_max_token_size=10 287SELECT @@innodb_ft_min_token_size,@@innodb_ft_max_token_size; 288@@innodb_ft_min_token_size @@innodb_ft_max_token_size 2895 10 290ALTER TABLE t1 DROP INDEX idx; 291SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE); 292ERROR HY000: Can't find FULLTEXT index matching the column list 293CREATE FULLTEXT INDEX idx on t1 (a,b) WITH PARSER simple_parser; 294ALTER TABLE t1 DROP INDEX idx; 295CREATE FULLTEXT INDEX idx on t1 (a,b); 296SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE); 297id a b 2981 MySQL from Tutorial DBMS stands for DataBase ... 2992 when To Use MySQL Well After that you went through a ... 3003 where will Optimizing MySQL what In this tutorial we will show ... 301SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('MySQL'); 302id a b 3031 MySQL from Tutorial DBMS stands for DataBase ... 3042 when To Use MySQL Well After that you went through a ... 3053 where will Optimizing MySQL what In this tutorial we will show ... 306SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('dbms'); 307id a b 308SELECT * FROM t1 WHERE MATCH (b) AGAINST ('show'); 309id a b 3103 where will Optimizing MySQL what In this tutorial we will show ... 311SELECT * FROM t1 WHERE MATCH (b) AGAINST ('dbms') AND MATCH (a,b) AGAINST ('transactions'); 312id a b 313SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('transactions'); 314id a b 315SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); 316id a b 3171 MySQL from Tutorial DBMS stands for DataBase ... 318SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('NULL' IN BOOLEAN MODE); 319id a b 320SELECT * FROM t1 WHERE b IS NULL or a IS NULL; 321id a b 3229 NULL NULL 323CREATE TABLE t1_join AS SELECT * FROM t1; 324CREATE FULLTEXT INDEX idx on t1_join (a,b) WITH PARSER simple_parser; 325Warnings: 326Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID 327SELECT t1.id,t1_join.id FROM t1,t1_join WHERE MATCH (t1.a,t1.b) AGAINST ('Tutorial') AND t1.id = t1_join.id ; 328id id 3291 1 3303 3 331SELECT * FROM t1 WHERE MATCH (a) AGAINST ('NULL'); 332ERROR HY000: Can't find FULLTEXT index matching the column list 333DROP TABLE t1; 334DROP TABLE t1_join; 335CREATE TABLE t1 ( 336a VARCHAR(200), 337FULLTEXT (a) WITH PARSER ngram 338)ENGINE = InnoDB; 339SELECT * FROM t1 WHERE MATCH(a) AGAINST("')'@7" IN BOOLEAN MODE); 340a 341DROP TABLE t1; 342UNINSTALL PLUGIN simple_parser; 343# restart 344