| 1 |
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; |
| 2 |
# Test Part 1: Grammar Test |
| 3 |
CREATE TABLE articles ( |
| 4 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 5 |
title VARCHAR(200), |
| 6 |
FULLTEXT (title) WITH PARSER simple_parser |
| 7 |
) ENGINE=MyISAM; |
| 8 |
ALTER TABLE articles ENGINE=InnoDB; |
| 9 |
DROP TABLE articles; |
| 10 |
CREATE TABLE articles ( |
| 11 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 12 |
title VARCHAR(200), |
| 13 |
body TEXT, |
| 14 |
comment TEXT, |
| 15 |
FULLTEXT (title) WITH PARSER simple_parser |
| 16 |
) ENGINE=InnoDB; |
| 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) |
| 21 |
CREATE TABLE articles ( |
| 22 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 23 |
title VARCHAR(200), |
| 24 |
body TEXT, |
| 25 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 26 |
) ENGINE=InnoDB; |
| 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 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 96 |
2 How To Use MySQL Well After you went through a ... |
| 97 |
3 Optimizing MySQL In this tutorial we will show ... |
| 98 |
4 1001 MySQL Tricks How to use full-text search engine |
| 99 |
5 Go MySQL Tricks How to use full text search engine |
| 100 |
SELECT * FROM articles WHERE |
| 101 |
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); |
| 102 |
id title body |
| 103 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 104 |
2 How To Use MySQL Well After you went through a ... |
| 105 |
3 Optimizing MySQL In this tutorial we will show ... |
| 106 |
4 1001 MySQL Tricks How to use full-text search engine |
| 107 |
5 Go MySQL Tricks How to use full text search engine |
| 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 |
# Kill and restart |
| 128 |
SELECT COUNT(*) FROM articles; |
| 129 |
COUNT(*) |
| 130 |
0 |
| 131 |
SELECT title, body FROM articles WHERE |
| 132 |
MATCH(title, body) AGAINST('mysql'); |
| 133 |
title body |
| 134 |
INSERT INTO articles (title, body) VALUES |
| 135 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 136 |
('How To Use MySQL Well','After you went through a ...'), |
| 137 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 138 |
('1001 MySQL Tricks','How to use full-text search engine'), |
| 139 |
('Go MySQL Tricks','How to use full text search engine'); |
| 140 |
# Kill and restart |
| 141 |
SELECT title, body FROM articles WHERE |
| 142 |
MATCH(title, body) AGAINST('Tricks'); |
| 143 |
title body |
| 144 |
1001 MySQL Tricks How to use full-text search engine |
| 145 |
Go MySQL Tricks How to use full text search engine |
| 146 |
SELECT COUNT(*) FROM articles; |
| 147 |
COUNT(*) |
| 148 |
5 |
| 149 |
DROP TABLE articles; |
| 150 |
# Test Part 5: Test Uninstall Plugin After Index is Built |
| 151 |
CREATE TABLE articles ( |
| 152 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 153 |
title VARCHAR(200), |
| 154 |
body TEXT, |
| 155 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 156 |
) ENGINE=InnoDB; |
| 157 |
UNINSTALL PLUGIN simple_parser; |
| 158 |
INSERT INTO articles (title, body) VALUES |
| 159 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'); |
| 160 |
ERROR HY000: Plugin 'simple_parser' is not loaded |
| 161 |
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; |
| 162 |
INSERT INTO articles (title, body) VALUES |
| 163 |
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), |
| 164 |
('How To Use MySQL Well','After you went through a ...'), |
| 165 |
('Optimizing MySQL','In this tutorial we will show ...'), |
| 166 |
('1001 MySQL Tricks','How to use full-text search engine'), |
| 167 |
('Go MySQL Tricks','How to use full text search engine'); |
| 168 |
UNINSTALL PLUGIN simple_parser; |
| 169 |
Warnings: |
| 170 |
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 171 |
SELECT * FROM articles WHERE |
| 172 |
MATCH(title, body) AGAINST('mysql'); |
| 173 |
id title body |
| 174 |
1 MySQL Tutorial DBMS stands for MySQL DataBase ... |
| 175 |
2 How To Use MySQL Well After you went through a ... |
| 176 |
3 Optimizing MySQL In this tutorial we will show ... |
| 177 |
4 1001 MySQL Tricks How to use full-text search engine |
| 178 |
5 Go MySQL Tricks How to use full text search engine |
| 179 |
SELECT * FROM articles WHERE |
| 180 |
MATCH(title, body) AGAINST('will go'); |
| 181 |
id title body |
| 182 |
# Test plugin parser tokenizer difference |
| 183 |
SELECT * FROM articles WHERE |
| 184 |
MATCH(title, body) AGAINST('full-text'); |
| 185 |
id title body |
| 186 |
4 1001 MySQL Tricks How to use full-text search engine |
| 187 |
SELECT * FROM articles WHERE |
| 188 |
MATCH(title, body) AGAINST('full text'); |
| 189 |
id title body |
| 190 |
5 Go MySQL Tricks How to use full text search engine |
| 191 |
CREATE TABLE articles2 ( |
| 192 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 193 |
title VARCHAR(200), |
| 194 |
body TEXT, |
| 195 |
FULLTEXT (title, body) WITH PARSER simple_parser |
| 196 |
) ENGINE=InnoDB; |
| 197 |
ERROR HY000: Function 'simple_parser' is not defined |
| 198 |
DROP TABLE articles; |
| 199 |
UNINSTALL PLUGIN simple_parser; |
| 200 |
ERROR 42000: PLUGIN simple_parser does not exist |