Commit ea3262dc authored by Sergei Golubchik's avatar Sergei Golubchik

Fix innodb_fts suite

* update (some) tests from 5.7
* update results (e.g. cardinality is no longer reported)
* uncomment MYSQL_PLUGIN_FULLTEXT_PARSER/MYSQL_FTS_PARSER code
* initialize m_prebuilt->m_fts_limit manually,
   as we do not use ft_init_ext_with_hints()
parent 4133d294
......@@ -8,8 +8,8 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
ANALYZE TABLE t1;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL 5 NULL NULL YES FULLTEXT
t1 1 a 2 b NULL 5 NULL NULL YES FULLTEXT
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Full-text indexes are called collections
......@@ -235,7 +235,7 @@ id
show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 1 tig 1 ticket A 3 NULL NULL YES BTREE
t2 1 tix 1 inhalt NULL 3 NULL NULL YES FULLTEXT
t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
......
drop table if exists t2,t1;
set names utf8;
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`t1`");
CREATE TABLE t1 (
id1 INT ,
a1 VARCHAR(200) ,
......@@ -34,46 +35,52 @@ INSERT INTO t2 (a2,b2) VALUES
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
DELETE FROM t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
id1
1
3
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
id2
1
3
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
id1
1
3
6
2
3
4
5
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
6
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
id2
1
3
6
2
3
4
5
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
6
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
id1
1
2
3
4
5
6
2
4
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
id2
1
2
3
4
5
6
2
4
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
id1
1
......@@ -93,23 +100,23 @@ SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN
id2
3
6
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id1;
id1
4
2
6
1
5
2
3
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ;
id2
4
2
5
6
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id2;
id2
1
5
2
3
SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%';
4
5
6
SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
id2
1
2
......@@ -221,8 +228,7 @@ id1 a1 b1
SELECT * FROM t2 WHERE a2 LIKE '%tutorial%';
id2 a2 b2
DROP TABLE t2 , t1;
DROP TABLE IF EXISTS t2,t1;
SET NAMES utf8;
call mtr.add_suppression("\\[ERROR\\] InnoDB: FTS Doc ID must be larger than 3 for table `test`.`t2`");
CREATE TABLE t1 (
id1 INT ,
a1 VARCHAR(200) ,
......@@ -258,34 +264,34 @@ INSERT INTO t2 (a2,b2) VALUES
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
DELETE FROM t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
id1 a1 b1
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
id2 a2 b2
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
id1 a1 b1
3 Optimizing MySQL In this tutorial we will show ...
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
id2 a2 b2
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
id2 a2 b2
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
id1 a1 b1
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
3 Optimizing MySQL In this tutorial we will show ...
2 How To Use MySQL Well After you went through a ...
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
id2 a2 b2
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
3 Optimizing MySQL In this tutorial we will show ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
id1 a1 b1
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
......@@ -308,15 +314,15 @@ SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"database comparison"@02' IN BOOL
id1 a1 b1
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
id2 a2 b2
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY id1;
id1 a1 b1
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
2 How To Use MySQL Well After you went through a ...
6 MySQL Security When configured properly, MySQL ...
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
5 MySQL vs. YourSQL In the following database comparison ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM t2;
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
5 MySQL vs. YourSQL In the following database comparison ...
6 MySQL Security When configured properly, MySQL ...
SELECT * FROM t2 ORDER BY id2;
id2 a2 b2
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
......@@ -335,23 +341,23 @@ SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN B
id2 a2 b2
3 changing column - on UPDATE cascade In this tutorial we will show ...
6 changing column - on UPDATE cascade When configured properly, MySQL ...
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id1;
id1 a1 b1
4 changing column - on UPDATE cascade to check foreign constraint
2 changing column - on UPDATE cascade to check foreign constraint
6 changing column - on UPDATE cascade to check foreign constraint
1 changing column - on UPDATE cascade to check foreign constraint
5 changing column - on UPDATE cascade to check foreign constraint
2 changing column - on UPDATE cascade to check foreign constraint
3 changing column - on UPDATE cascade to check foreign constraint
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ;
4 changing column - on UPDATE cascade to check foreign constraint
5 changing column - on UPDATE cascade to check foreign constraint
6 changing column - on UPDATE cascade to check foreign constraint
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id2;
id2 a2 b2
4 changing column - on UPDATE cascade 1. Never run mysqld as root. 2. ...
2 changing column - on UPDATE cascade After you went through a ...
6 changing column - on UPDATE cascade When configured properly, MySQL ...
1 changing column - on UPDATE cascade DBMS stands for DataBase VÐƷWİ...
5 changing column - on UPDATE cascade In the following database comparison ...
2 changing column - on UPDATE cascade After you went through a ...
3 changing column - on UPDATE cascade In this tutorial we will show ...
SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%';
4 changing column - on UPDATE cascade 1. Never run mysqld as root. 2. ...
5 changing column - on UPDATE cascade In the following database comparison ...
6 changing column - on UPDATE cascade When configured properly, MySQL ...
SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
id2 a2 b2
1 changing column - on UPDATE cascade DBMS stands for DataBase VÐƷWİ...
2 changing column - on UPDATE cascade After you went through a ...
......@@ -456,10 +462,7 @@ ROLLBACK;
SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
s1 s2
DROP TABLE t2 , t1;
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
set names utf8;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
a VARCHAR(200),
......@@ -481,13 +484,16 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`),
FULLTEXT KEY `idx` (`a`,`b`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED
SELECT count(*) FROM information_schema.innodb_sys_tables WHERE name LIKE "%FTS_%" AND space !=0;
count(*)
11
INSERT INTO t1 (a,b) VALUES
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
ANALYZE TABLE t1;
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
id a b
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
3 Optimizing MySQL In this tutorial we will show ...
......@@ -499,14 +505,14 @@ ERROR 42000: syntax error, unexpected '-'
select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
id a b
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
id a b
6 MySQL Security When configured properly, MySQL ...
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
5 MySQL vs. YourSQL In the following database comparison ...
select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1;
6 MySQL Security When configured properly, MySQL ...
select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1 ORDER BY id;
id a b x
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ... 0.6055193543434143
2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
......@@ -519,18 +525,18 @@ id a b
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
id a b
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
id a b
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
5 MySQL vs. YourSQL In the following database comparison ...
6 MySQL Security When configured properly, MySQL ...
2 How To Use MySQL Well After you went through a ...
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
ALTER TABLE t1 DROP INDEX idx;
CREATE FULLTEXT INDEX idx on t1 (a,b);
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
id a b
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
3 Optimizing MySQL In this tutorial we will show ...
......@@ -543,14 +549,14 @@ id a b
select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
id a b
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
id a b
6 MySQL Security When configured properly, MySQL ...
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
5 MySQL vs. YourSQL In the following database comparison ...
select *, MATCH(a,b) AGAINST("mysql VÐƷWİ" IN BOOLEAN MODE) as x from t1;
6 MySQL Security When configured properly, MySQL ...
select *, MATCH(a,b) AGAINST("mysql VÐƷWİ" IN BOOLEAN MODE) as x from t1 ORDER BY id;
id a b x
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ... 0.6055193543434143
2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
......@@ -560,14 +566,14 @@ id a b x
6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372
select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
id a b
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
id a b
1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
5 MySQL vs. YourSQL In the following database comparison ...
6 MySQL Security When configured properly, MySQL ...
2 How To Use MySQL Well After you went through a ...
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
INSERT INTO t1 (a,b) VALUES
('test proximity search, test, proximity and phrase',
......@@ -589,14 +595,14 @@ AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
id a b
SELECT * FROM t1
WHERE MATCH (a,b)
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
AGAINST ('"proximity search"@3' IN BOOLEAN MODE) ORDER BY id;
id a b
8 test proximity search, test, proximity and phrase search, with proximity innodb
9 test proximity fts search, test, proximity and phrase search, with proximity innodb
10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb
SELECT * FROM t1
WHERE MATCH (a,b)
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
AGAINST ('"test proximity"@5' IN BOOLEAN MODE) ORDER BY id;
id a b
8 test proximity search, test, proximity and phrase search, with proximity innodb
9 test proximity fts search, test, proximity and phrase search, with proximity innodb
......@@ -624,7 +630,7 @@ select * from t1 where MATCH(a,b) AGAINST("+VÐƷWİ" IN BOOLEAN MODE);
id a b
1 MYSQL TUTORIAL dbms stands for database vðʒwi...
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
id a b
1 MYSQL TUTORIAL dbms stands for database vðʒwi...
3 OPTIMIZING MYSQL in this tutorial we will show ...
......@@ -633,7 +639,7 @@ DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"proximity search"@14' IN BOOLEAN MOD
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
id a b
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY id;
id a b
2 HOW TO USE MYSQL WELL after you went through a ...
4 1001 MYSQL TRICKS 1. never run mysqld as root. 2. ...
......@@ -641,7 +647,7 @@ id a b
6 MYSQL SECURITY when configured properly, mysql ...
7 TEST QUERY EXPANSION for database ...
DROP TABLE t1;
set names utf8;
SET GLOBAL innodb_file_per_table=1;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
a VARCHAR(200),
......@@ -662,14 +668,14 @@ INSERT INTO t1 (a,b) VALUES
CREATE FULLTEXT INDEX idx on t1 (a,b);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωρὶς");
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωρὶς") ORDER BY id;
id a b
1 Я могу есть стекло оно мне не вредит
3 Μπορῶ νὰ φάω σπασμένα γυαλιὰ χωρὶς νὰ πάθω τίποτα
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("оно" WITH QUERY EXPANSION);
id a b
1 Я могу есть стекло оно мне не вредит
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE) ORDER BY id;
id a b
1 Я могу есть стекло оно мне не вредит
2 Мога да ям стъкло то не ми вреди
......@@ -731,7 +737,7 @@ id a b
7 Pchnąć w tę łódź jeża lub osiem skrzyń fig
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE);
id a b
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE) ORDER BY id;
id a b
1 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
2 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
......@@ -742,7 +748,7 @@ WHERE MATCH (a,b)
AGAINST ('"łódź jeża"@2' IN BOOLEAN MODE);
id a b
7 Pchnąć w tę łódź jeża lub osiem skrzyń fig
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY id;
id a b
1 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
2 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
......
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
# Test Part 1: Grammar Test
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM;
ALTER TABLE articles ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
DROP TABLE articles;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
comment TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser;
DROP TABLE articles;
# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title)
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
DROP TABLE articles;
# Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT
) ENGINE=InnoDB;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
id title body
5 Go MySQL Tricks How to use full text search engine
4 1001 MySQL Tricks How to use full-text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
DROP TABLE articles;
# Test Part 3 END
# Test Part 4:crash on commit(before/after)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
BEGIN;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT COUNT(*) FROM articles;
COUNT(*)
0
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT COUNT(*) FROM articles;
COUNT(*)
5
DROP TABLE articles;
# Test Part 5: Test Uninstall Plugin After Index is Built
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
UNINSTALL PLUGIN simple_parser;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...');
ERROR HY000: Plugin 'simple_parser' is not loaded
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
UNINSTALL PLUGIN simple_parser;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
CREATE TABLE articles2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
ERROR HY000: Function 'simple_parser' is not defined
DROP TABLE articles;
UNINSTALL PLUGIN simple_parser;
ERROR 42000: PLUGIN simple_parser does not exist
......@@ -128,7 +128,7 @@ WHERE MATCH (a,b)
AGAINST ('"mysql use"@1' IN BOOLEAN MODE);
id a b
INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000));
INSERT INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
INSERT IGNORE INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT count(*) FROM t1
......@@ -137,7 +137,6 @@ AGAINST ('"xyz blob"@3' IN BOOLEAN MODE);
count(*)
2
DROP TABLE t1;
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
......@@ -225,5 +224,4 @@ AGAINST ('"very blob"@3' IN BOOLEAN MODE);
count(*)
1
DROP TABLE t1;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_per_table=1;
......@@ -2,6 +2,8 @@
-- source include/have_innodb.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
# Create FTS table
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
......
--source include/have_innodb.inc
#------------------------------------------------------------------------------
# FTS with FK and update cascade
#-------------------------------------------------------------------------------
--source include/have_innodb.inc
if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in InnoDB 5.6.10 or earlier
}
--disable_warnings
drop table if exists t2,t1;
--enable_warnings
set names utf8;
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`t1`");
# Create FTS table
CREATE TABLE t1 (
id1 INT ,
......@@ -63,14 +57,17 @@ INSERT INTO t2 (a2,b2) VALUES
--error 1451
DELETE FROM t1;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ;
ANALYZE TABLE t1;
ANALYZE TABLE t2;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
......@@ -89,10 +86,10 @@ SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
# it shows updated record
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ;
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id1;
# InnoDB:Error child table does not show the expected record
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ;
SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%';
SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id2;
SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
DROP TABLE t2 , t1;
......@@ -220,11 +217,8 @@ DROP TABLE t2 , t1;
#------------------------------------------------------------------------------
# FTS with FK+transactions and UPDATE casecade with transaction
#-------------------------------------------------------------------------------
--disable_warnings
DROP TABLE IF EXISTS t2,t1;
--enable_warnings
SET NAMES utf8;
call mtr.add_suppression("\\[ERROR\\] InnoDB: FTS Doc ID must be larger than 3 for table `test`.`t2`");
# Create FTS table
CREATE TABLE t1 (
......@@ -277,12 +271,12 @@ INSERT INTO t2 (a2,b2) VALUES
DELETE FROM t1;
# records expected
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
......@@ -296,8 +290,8 @@ SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root' WITH QUERY EXPANSION) ;
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t1 ORDER BY id1;
SELECT * FROM t2 ORDER BY id2;
COMMIT;
......@@ -312,9 +306,9 @@ SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN B
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
# it shows updated record
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ;
SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%';
SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id1;
SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id2;
SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
DROP TABLE t2 , t1;
......@@ -434,18 +428,9 @@ DROP TABLE t2 , t1;
#------------------------------------------------------------------------------
# Save innodb variables
--disable_query_log
let $innodb_file_format_orig=`select @@innodb_file_format`;
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
let $innodb_large_prefix_orig=`select @@innodb_large_prefix`;
--enable_query_log
# Set Innodb file format as feature works for Barracuda file format
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
set names utf8;
# Create FTS table
CREATE TABLE t1 (
......@@ -464,6 +449,9 @@ INSERT INTO t1 (a,b) VALUES
ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
EVAL SHOW CREATE TABLE t1;
# Check whether individual space id created for AUX tables
SELECT count(*) FROM information_schema.innodb_sys_tables WHERE name LIKE "%FTS_%" AND space !=0;
# Insert rows
INSERT INTO t1 (a,b) VALUES
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
......@@ -476,20 +464,20 @@ ANALYZE TABLE t1;
# Select word "tutorial" in the table
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
# boolean mode
select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÐƷWİ" IN BOOLEAN MODE);
--error ER_PARSE_ERROR
select * from t1 where MATCH(a,b) AGAINST("+-VÐƷWİ" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE);
select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1;
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1 ORDER BY id;
select * from t1 where MATCH a,b AGAINST ("+database* +VÐƷW*" IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
# query expansion
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
# Drop index
ALTER TABLE t1 DROP INDEX idx;
......@@ -505,20 +493,20 @@ ANALYZE TABLE t1;
# Select word "tutorial" in the table
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
# boolean mode
select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÐƷWİ" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+dbms" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE);
select *, MATCH(a,b) AGAINST("mysql VÐƷWİ" IN BOOLEAN MODE) as x from t1;
select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
select *, MATCH(a,b) AGAINST("mysql VÐƷWİ" IN BOOLEAN MODE) as x from t1 ORDER BY id;
# Innodb:Assert eval0eval.c line 148
#select * from t1 where MATCH a,b AGAINST ("+database* +VÐƷWİ*" IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
# query expansion
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
# insert for proximity search
......@@ -549,12 +537,12 @@ SELECT * FROM t1
# This give you all three documents
SELECT * FROM t1
WHERE MATCH (a,b)
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
AGAINST ('"proximity search"@3' IN BOOLEAN MODE) ORDER BY id;
# Similar boundary testing for the words
SELECT * FROM t1
WHERE MATCH (a,b)
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
AGAINST ('"test proximity"@5' IN BOOLEAN MODE) ORDER BY id;
# Test with more word The last document will return, please notice there
# is no ordering requirement for proximity search.
......@@ -579,7 +567,7 @@ select * from t1 where MATCH(a,b) AGAINST("+tutorial +dbms" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+VÐƷWİ" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"proximity search"@14' IN BOOLEAN MODE);
......@@ -588,20 +576,14 @@ DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"proximity search"@14' IN BOOLEAN MOD
SELECT * FROM t1 WHERE MATCH (a,b)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1;
--disable_query_log
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
eval SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
eval SET GLOBAL innodb_large_prefix=$innodb_large_prefix_orig;
--enable_query_log
#------------------------------------------------------------------------------
# FTS index with utf8 character testcase
#------------------------------------------------------------------------------
set names utf8;
# Create FTS table
EVAL CREATE TABLE t1 (
......@@ -631,10 +613,10 @@ INSERT INTO t1 (a,b) VALUES
CREATE FULLTEXT INDEX idx on t1 (a,b);
# FTS Queries
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωρὶς");
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωρὶς") ORDER BY id;
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("оно" WITH QUERY EXPANSION);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE) ORDER BY id;
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+γυαλιὰ +tutorial" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+tutorial +(Мога τίποτα)" IN BOOLEAN MODE);
......@@ -682,14 +664,14 @@ DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("łódź osiem");
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE) ORDER BY id;
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
SELECT * FROM t1
WHERE MATCH (a,b)
AGAINST ('"łódź jeża"@2' IN BOOLEAN MODE);
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1;
# This is to test the update operation on FTS indexed and non-indexed
......
--source include/have_simple_parser.inc
--source include/have_innodb.inc
--source include/have_simple_parser.inc
# Restart is not supported in embedded
--source include/not_embedded.inc
# Install fts parser plugin
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
-- echo # Test Part 1: Grammar Test
# Create a myisam table and alter it to innodb table
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM;
--error ER_INNODB_NO_FT_USES_PARSER
ALTER TABLE articles ENGINE=InnoDB;
DROP TABLE articles;
# Create a table having a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
comment TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB;
# Alter table to add a full text index with parser
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
# Create a full text index with parser
CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser;
DROP TABLE articles;
-- echo # Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title)
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
# Alter table to add a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
# Create a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser;
# Simple term search
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
# Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
-- echo # Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
# No result here, we get '"mysql' 'database"' by simple parser
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
DROP TABLE articles;
-- echo # Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT
) ENGINE=InnoDB;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
# Create fulltext index
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
# Simple term search
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
# Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
-- echo # Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
# Test query expansion
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
# No result here, we get '"mysql' 'database"' by simple parser
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
DROP TABLE articles;
-- echo # Test Part 3 END
-- echo # Test Part 4:crash on commit(before/after)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
BEGIN;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
--source include/restart_mysqld.inc
SELECT COUNT(*) FROM articles;
# Simple term search - no records expected
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
--source include/restart_mysqld.inc
# Simple term search - 4 records expected
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
SELECT COUNT(*) FROM articles;
DROP TABLE articles;
-- echo # Test Part 5: Test Uninstall Plugin After Index is Built
# Note: this test should be the last one because we uninstall plugin
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
# Uninstall plugin
UNINSTALL PLUGIN simple_parser;
-- error ER_PLUGIN_IS_NOT_LOADED
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...');
# Reinstall plugin
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
# Get warning here
UNINSTALL PLUGIN simple_parser;
# Simple term search
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
# Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
-- echo # Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
-- error ER_FUNCTION_NOT_DEFINED
CREATE TABLE articles2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
DROP TABLE articles;
# Uninstall plugin
-- error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN simple_parser;
--source include/have_innodb.inc
# This is the DDL function tests for innodb FTS
# Functional testing with FTS proximity search using '@'
# and try search default words
--source include/have_innodb.inc
if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in InnoDB 5.6.10 or earlier
}
--disable_warnings
drop table if exists t1;
--enable_warnings
--disable_query_log
let $innodb_file_format_orig = `select @@innodb_file_format`;
let $innodb_file_per_table_orig = `select @@innodb_file_per_table`;
--enable_query_log
......@@ -156,7 +151,7 @@ SELECT * FROM t1
INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000));
INSERT INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
INSERT IGNORE INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
# 2 rows match
SELECT count(*) FROM t1
......@@ -165,7 +160,6 @@ SELECT count(*) FROM t1
DROP TABLE t1;
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1;
# Test fts with externally stored long column
......@@ -263,5 +257,4 @@ SELECT count(*) FROM t1
DROP TABLE t1;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
......@@ -7215,7 +7215,6 @@ ha_innobase::open(
dict_table_autoinc_unlock(m_prebuilt->table);
}
#if MYSQL_PLUGIN_FULLTEXT_PARSER
/* Set plugin parser for fulltext index */
for (uint i = 0; i < table->s->keys; i++) {
if (table->key_info[i].flags & HA_USES_PARSER) {
......@@ -7236,7 +7235,6 @@ ha_innobase::open(
index->parser = &fts_default_parser;);
}
}
#endif
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
......@@ -11148,6 +11146,8 @@ ha_innobase::ft_init_ext(
const byte* q = reinterpret_cast<const byte*>(
const_cast<char*>(query));
// JAN: TODO: support for ft_init_ext_with_hints(), remove the line below
m_prebuilt->m_fts_limit= ULONG_UNDEFINED;
dberr_t error = fts_query(trx, index, flags, q, query_len, &result,
m_prebuilt->m_fts_limit);
......
......@@ -632,6 +632,8 @@ extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id);
extern const struct _ft_vft ft_vft_result;
#define FTS_NGRAM_PARSER_NAME "ngram"
/** Structure Returned by ha_innobase::ft_init_ext() */
typedef struct new_ft_info
{
......
......@@ -2248,7 +2248,6 @@ innobase_create_index_def(
| HA_BINARY_PACK_KEY)));
index->ind_type = DICT_FTS;
#ifdef MYSQL_FTS_PARSER
/* Note: key->parser is only parser name,
we need to get parser from altered_table instead */
......@@ -2279,7 +2278,6 @@ innobase_create_index_def(
index->parser = &fts_default_parser;);
ut_ad(index->parser);
}
#endif /* MYSQL_FTS_PARSER */
} else if (key->flags & HA_SPATIAL) {
DBUG_ASSERT(!(key->flags & HA_NOSAME));
index->ind_type = DICT_SPATIAL;
......
......@@ -43,7 +43,6 @@ struct fts_string_t;
#undef MYSQL_57_SELECT_COUNT_OPTIMIZATION
#undef MYSQL_COMPRESSION
#undef MYSQL_ENCRYPTION
#undef MYSQL_FTS_PARSER
#undef MYSQL_FT_INIT_EXT
#undef MYSQL_INNODB_API_CB
#undef MYSQL_INNODB_PARTITIONING
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment