|
1 | 1 | INSTALL PLUGIN simple_parser SONAME 'mypluglib';
|
| 2 | +# Test Part 1: Grammar Test |
2 | 3 | CREATE TABLE articles (
|
3 | 4 | id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
4 | 5 | title VARCHAR(200),
|
5 |
| -body TEXT, |
6 | 6 | FULLTEXT (title) WITH PARSER simple_parser
|
7 | 7 | ) ENGINE=MyISAM;
|
8 | 8 | ALTER TABLE articles ENGINE=InnoDB;
|
9 |
| -ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table |
10 | 9 | DROP TABLE articles;
|
11 | 10 | CREATE TABLE articles (
|
12 | 11 | id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
13 | 12 | title VARCHAR(200),
|
14 | 13 | body TEXT,
|
| 14 | +comment TEXT, |
15 | 15 | FULLTEXT (title) WITH PARSER simple_parser
|
16 | 16 | ) ENGINE=InnoDB;
|
17 |
| -ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table |
| 17 | +ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser; |
| 18 | +CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser; |
| 19 | +DROP TABLE articles; |
| 20 | +# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX) |
18 | 21 | CREATE TABLE articles (
|
19 | 22 | id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
20 | 23 | title VARCHAR(200),
|
21 | 24 | body TEXT,
|
22 |
| -FULLTEXT (title) |
| 25 | +FULLTEXT (title, body) WITH PARSER simple_parser |
23 | 26 | ) ENGINE=InnoDB;
|
24 |
| -ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser; |
25 |
| -ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table |
26 |
| -CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser; |
27 |
| -ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table |
| 27 | +INSERT INTO articles (title, body) VALUES |
| 28 | +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 29 | +('How To Use MySQL Well','After you went through a ...'), |
| 30 | +('Optimizing MySQL','In this tutorial we will show ...'), |
| 31 | +('1001 MySQL Tricks','How to use full-text search engine'), |
| 32 | +('Go MySQL Tricks','How to use full text search engine'); |
| 33 | +SELECT * FROM articles WHERE |
| 34 | +MATCH(title, body) AGAINST('mysql'); |
| 35 | +id title body |
| 36 | +1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 37 | +2 How To Use MySQL Well After you went through a ... |
| 38 | +3 Optimizing MySQL In this tutorial we will show ... |
| 39 | +4 1001 MySQL Tricks How to use full-text search engine |
| 40 | +5 Go MySQL Tricks How to use full text search engine |
| 41 | +SELECT * FROM articles WHERE |
| 42 | +MATCH(title, body) AGAINST('will go'); |
| 43 | +id title body |
| 44 | +# Test plugin parser tokenizer difference |
| 45 | +SELECT * FROM articles WHERE |
| 46 | +MATCH(title, body) AGAINST('full-text'); |
| 47 | +id title body |
| 48 | +4 1001 MySQL Tricks How to use full-text search engine |
| 49 | +SELECT * FROM articles WHERE |
| 50 | +MATCH(title, body) AGAINST('full text'); |
| 51 | +id title body |
| 52 | +5 Go MySQL Tricks How to use full text search engine |
| 53 | +SELECT * FROM articles WHERE |
| 54 | +MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 55 | +id title body |
| 56 | +DROP TABLE articles; |
| 57 | +# Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX) |
| 58 | +CREATE TABLE articles ( |
| 59 | +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 60 | +title VARCHAR(200), |
| 61 | +body TEXT |
| 62 | +) ENGINE=InnoDB; |
| 63 | +INSERT INTO articles (title, body) VALUES |
| 64 | +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 65 | +('How To Use MySQL Well','After you went through a ...'), |
| 66 | +('Optimizing MySQL','In this tutorial we will show ...'), |
| 67 | +('1001 MySQL Tricks','How to use full-text search engine'), |
| 68 | +('Go MySQL Tricks','How to use full text search engine'); |
| 69 | +ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; |
| 70 | +Warnings: |
| 71 | +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID |
| 72 | +SELECT * FROM articles WHERE |
| 73 | +MATCH(title, body) AGAINST('mysql'); |
| 74 | +id title body |
| 75 | +1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 76 | +2 How To Use MySQL Well After you went through a ... |
| 77 | +3 Optimizing MySQL In this tutorial we will show ... |
| 78 | +4 1001 MySQL Tricks How to use full-text search engine |
| 79 | +5 Go MySQL Tricks How to use full text search engine |
| 80 | +SELECT * FROM articles WHERE |
| 81 | +MATCH(title, body) AGAINST('will go'); |
| 82 | +id title body |
| 83 | +# Test plugin parser tokenizer difference |
| 84 | +SELECT * FROM articles WHERE |
| 85 | +MATCH(title, body) AGAINST('full-text'); |
| 86 | +id title body |
| 87 | +4 1001 MySQL Tricks How to use full-text search engine |
| 88 | +SELECT * FROM articles WHERE |
| 89 | +MATCH(title, body) AGAINST('full text'); |
| 90 | +id title body |
| 91 | +5 Go MySQL Tricks How to use full text search engine |
| 92 | +SELECT * FROM articles WHERE |
| 93 | +MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); |
| 94 | +id title body |
| 95 | +4 1001 MySQL Tricks How to use full-text search engine |
| 96 | +5 Go MySQL Tricks How to use full text search engine |
| 97 | +2 How To Use MySQL Well After you went through a ... |
| 98 | +1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 99 | +3 Optimizing MySQL In this tutorial we will show ... |
| 100 | +SELECT * FROM articles WHERE |
| 101 | +MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); |
| 102 | +id title body |
| 103 | +5 Go MySQL Tricks How to use full text search engine |
| 104 | +4 1001 MySQL Tricks How to use full-text search engine |
| 105 | +2 How To Use MySQL Well After you went through a ... |
| 106 | +1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 107 | +3 Optimizing MySQL In this tutorial we will show ... |
| 108 | +SELECT * FROM articles WHERE |
| 109 | +MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); |
| 110 | +id title body |
| 111 | +DROP TABLE articles; |
| 112 | +# Test Part 3 END |
| 113 | +# Test Part 4:crash on commit(before/after) |
| 114 | +CREATE TABLE articles ( |
| 115 | +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 116 | +title VARCHAR(200), |
| 117 | +body TEXT, |
| 118 | +FULLTEXT (title, body) WITH PARSER simple_parser |
| 119 | +) ENGINE=InnoDB; |
| 120 | +BEGIN; |
| 121 | +INSERT INTO articles (title, body) VALUES |
| 122 | +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 123 | +('How To Use MySQL Well','After you went through a ...'), |
| 124 | +('Optimizing MySQL','In this tutorial we will show ...'), |
| 125 | +('1001 MySQL Tricks','How to use full-text search engine'), |
| 126 | +('Go MySQL Tricks','How to use full text search engine'); |
| 127 | +SELECT COUNT(*) FROM articles; |
| 128 | +COUNT(*) |
| 129 | +0 |
| 130 | +SELECT * FROM articles WHERE |
| 131 | +MATCH(title, body) AGAINST('mysql'); |
| 132 | +id title body |
| 133 | +INSERT INTO articles (title, body) VALUES |
| 134 | +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 135 | +('How To Use MySQL Well','After you went through a ...'), |
| 136 | +('Optimizing MySQL','In this tutorial we will show ...'), |
| 137 | +('1001 MySQL Tricks','How to use full-text search engine'), |
| 138 | +('Go MySQL Tricks','How to use full text search engine'); |
| 139 | +SELECT * FROM articles WHERE |
| 140 | +MATCH(title, body) AGAINST('Tricks'); |
| 141 | +id title body |
| 142 | +4 1001 MySQL Tricks How to use full-text search engine |
| 143 | +5 Go MySQL Tricks How to use full text search engine |
| 144 | +SELECT COUNT(*) FROM articles; |
| 145 | +COUNT(*) |
| 146 | +5 |
| 147 | +DROP TABLE articles; |
| 148 | +# Test Part 5: Test Uninstall Plugin After Index is Built |
| 149 | +CREATE TABLE articles ( |
| 150 | +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 151 | +title VARCHAR(200), |
| 152 | +body TEXT, |
| 153 | +FULLTEXT (title, body) WITH PARSER simple_parser |
| 154 | +) ENGINE=InnoDB; |
| 155 | +UNINSTALL PLUGIN simple_parser; |
| 156 | +INSERT INTO articles (title, body) VALUES |
| 157 | +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'); |
| 158 | +ERROR HY000: Plugin 'simple_parser' is not loaded |
| 159 | +INSTALL PLUGIN simple_parser SONAME 'mypluglib'; |
| 160 | +INSERT INTO articles (title, body) VALUES |
| 161 | +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 162 | +('How To Use MySQL Well','After you went through a ...'), |
| 163 | +('Optimizing MySQL','In this tutorial we will show ...'), |
| 164 | +('1001 MySQL Tricks','How to use full-text search engine'), |
| 165 | +('Go MySQL Tricks','How to use full text search engine'); |
| 166 | +UNINSTALL PLUGIN simple_parser; |
| 167 | +Warnings: |
| 168 | +Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 169 | +SELECT * FROM articles WHERE |
| 170 | +MATCH(title, body) AGAINST('mysql'); |
| 171 | +id title body |
| 172 | +1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 173 | +2 How To Use MySQL Well After you went through a ... |
| 174 | +3 Optimizing MySQL In this tutorial we will show ... |
| 175 | +4 1001 MySQL Tricks How to use full-text search engine |
| 176 | +5 Go MySQL Tricks How to use full text search engine |
| 177 | +SELECT * FROM articles WHERE |
| 178 | +MATCH(title, body) AGAINST('will go'); |
| 179 | +id title body |
| 180 | +# Test plugin parser tokenizer difference |
| 181 | +SELECT * FROM articles WHERE |
| 182 | +MATCH(title, body) AGAINST('full-text'); |
| 183 | +id title body |
| 184 | +4 1001 MySQL Tricks How to use full-text search engine |
| 185 | +SELECT * FROM articles WHERE |
| 186 | +MATCH(title, body) AGAINST('full text'); |
| 187 | +id title body |
| 188 | +5 Go MySQL Tricks How to use full text search engine |
| 189 | +CREATE TABLE articles2 ( |
| 190 | +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 191 | +title VARCHAR(200), |
| 192 | +body TEXT, |
| 193 | +FULLTEXT (title, body) WITH PARSER simple_parser |
| 194 | +) ENGINE=InnoDB; |
| 195 | +ERROR HY000: Function 'simple_parser' is not defined |
28 | 196 | DROP TABLE articles;
|
29 | 197 | UNINSTALL PLUGIN simple_parser;
|
| 198 | +ERROR 42000: PLUGIN simple_parser does not exist |
0 commit comments