[Commits] Rev 3818: initially added fts innodb in file:///home/bell/maria/bzr/work-maria-10.0-serg/

sanja at montyprogram.com sanja at montyprogram.com
Wed Aug 7 12:55:04 EEST 2013


At file:///home/bell/maria/bzr/work-maria-10.0-serg/

------------------------------------------------------------
revno: 3818
revision-id: sanja at montyprogram.com-20130807095500-98xn92oua9tr8wn4
parent: svoj at mariadb.org-20130806100207-8zkrkp2ygdazry5p
committer: sanja at montyprogram.com
branch nick: work-maria-10.0-serg
timestamp: Wed 2013-08-07 12:55:00 +0300
message:
  initially added fts innodb
-------------- next part --------------
=== added directory 'mysql-test/suite/innodb_fts'
=== added directory 'mysql-test/suite/innodb_fts/r'
=== added file 'mysql-test/suite/innodb_fts/r/fulltext.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,642 @@
+drop table if exists t1,t2,t3;
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+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		
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	100.00	Using where
+Warnings:
+Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections'))
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+select * from t1 where MATCH(a,b) AGAINST ("only");
+a	b
+Only MyISAM tables	support collections
+select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+a	b
+Only MyISAM tables	support collections
+Full-text indexes	are called collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+a	b
+Only MyISAM tables	support collections
+Full-text indexes	are called collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'QUERY EXPANSION)' at line 1
+explain select * from t1 where MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	Using where
+explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	100.00	Using where
+Warnings:
+Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('support -collections' in boolean mode))
+select * from t1 where MATCH(a,b) AGAINST("support  collections" IN BOOLEAN MODE);
+a	b
+Only MyISAM tables	support collections
+MySQL has now support	for full-text search
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST("support +collections" IN BOOLEAN MODE);
+a	b
+Only MyISAM tables	support collections
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST("sear*" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Function MATCH ... AGAINST()	is used to do a search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+a	b
+Only MyISAM tables	support collections
+select * from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Function MATCH ... AGAINST()	is used to do a search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+a	b
+Function MATCH ... AGAINST()	is used to do a search
+select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+a	b	x
+MySQL has now support	for full-text search	0.15835624933242798
+Full-text indexes	are called collections	0.15835624933242798
+Only MyISAM tables	support collections	0.31671249866485596
+Function MATCH ... AGAINST()	is used to do a search	0
+Full-text search in MySQL	implements vector space model	0
+select *, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+a	b	x
+MySQL has now support	for full-text search	0.15835624933242798
+Full-text indexes	are called collections	0.15835624933242798
+Only MyISAM tables	support collections	0.31671249866485596
+Function MATCH ... AGAINST()	is used to do a search	0
+Full-text search in MySQL	implements vector space model	0
+select * from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+select * from t1 where MATCH a,b AGAINST ('"now   support"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+select * from t1 where MATCH a,b AGAINST ('"text search"  "now support"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
+a	b
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('+collections -supp* -foobar*' IN BOOLEAN MODE);
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
+a	b
+Full-text search in MySQL	implements vector space model
+delete from t1 where a like "MySQL%";
+update t1 set a='some test foobar' where MATCH a,b AGAINST ('model');
+delete from t1 where MATCH(a,b) AGAINST ("indexes");
+select * from t1;
+a	b
+Only MyISAM tables	support collections
+Function MATCH ... AGAINST()	is used to do a search
+some test foobar	implements vector space model
+drop table t1;
+create table t1 (a varchar(200) not null, fulltext (a)) engine = innodb;
+insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
+select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
+a
+aaa10 bbb20
+aaa20 bbb15
+aaa30 bbb10
+select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
+select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
+a
+select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
+a
+aaa10 bbb20
+select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
+a
+select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
+drop table t1;
+CREATE TABLE t1 (
+id int(11),
+ticket int(11),
+KEY ti (id),
+KEY tit (ticket)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (2,3),(1,2);
+CREATE TABLE t2 (
+ticket int(11),
+inhalt text,
+KEY tig (ticket),
+fulltext index tix (inhalt)
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,'foo'),(2,'bar'),(3,'foobar');
+INSERT INTO t1 VALUES (3,3);
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+select ticket2.id FROM t2 as ttxt,t2
+INNER JOIN t1 as ticket2 ON ticket2.id = t2.ticket
+WHERE ticket2.id = ticket2.ticket and
+match(ttxt.inhalt) against ('foobar');
+id
+3
+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		
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `ticket` int(11) DEFAULT NULL,
+  `inhalt` text,
+  KEY `tig` (`ticket`),
+  FULLTEXT KEY `tix` (`inhalt`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select * from t2 where MATCH inhalt AGAINST (NULL);
+ticket	inhalt
+select * from t2 where  MATCH inhalt AGAINST ('foobar');
+ticket	inhalt
+3	foobar
+select * from t2 having MATCH inhalt AGAINST ('foobar');
+ticket	inhalt
+3	foobar
+CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i));
+ERROR HY000: Column 't' cannot be part of FULLTEXT index
+CREATE TABLE t3 (t int(11),i text,
+j varchar(200) CHARACTER SET latin2,
+fulltext tix (i,j));
+ERROR HY000: Column 'j' cannot be part of FULLTEXT index
+CREATE TABLE t3 (
+ticket int(11),
+inhalt text,
+KEY tig (ticket),
+fulltext index tix (inhalt)
+) ENGINE = InnoDB;
+select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
+ERROR HY000: Incorrect arguments to AGAINST
+select * from t2 where MATCH ticket AGAINST ('foobar');
+ERROR HY000: Can't find FULLTEXT index matching the column list
+select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
+ERROR HY000: Incorrect arguments to MATCH
+drop table t1,t2,t3;
+CREATE TABLE t1 (
+id int(11)  auto_increment,
+title varchar(100)  default '',
+PRIMARY KEY  (id),
+KEY ind5 (title)
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX ft1 ON t1(title);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+insert into t1 (title) values ('this is a test');
+select * from t1 where match title against ('test' in boolean mode);
+id	title
+1	this is a test
+update t1 set title='this is A test' where id=1;
+check table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+update t1 set title='this test once revealed a bug' where id=1;
+select * from t1;
+id	title
+1	this test once revealed a bug
+update t1 set title=NULL where id=1;
+drop table t1;
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE = InnoDB;
+insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
+SELECT * from t1 where MATCH (b) AGAINST ('apples');
+a	b
+insert into t1 values (2,"fullaaa fullzzz");
+select * from t1 where match b against ('full*' in boolean mode);
+a	b
+1	I wonder why the fulltext index doesnt work?
+2	fullaaa fullzzz
+drop table t1;
+CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial');
+select 8 from t1;
+8
+8
+8
+8
+8
+drop table t1;
+create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
+insert into t1 values ('aaaa');
+select * from t1 where match (a) against ('aaaa');
+a
+aaaa
+drop table t1;
+create table t1 ( ref_mag text not null, fulltext (ref_mag)) ENGINE = InnoDB;
+insert into t1 values ('test');
+select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
+ref_mag
+test
+alter table t1 change ref_mag ref_mag char (255) not null;
+select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
+ref_mag
+test
+drop table t1;
+create table t1 (t1_id int(11) primary key, name varchar(32)) ENGINE = InnoDB;
+insert into t1 values (1, 'data1');
+insert into t1 values (2, 'data2');
+create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)) ENGINE = InnoDB;
+insert into t2 values (1, 1, 'xxfoo');
+insert into t2 values (2, 1, 'xxbar');
+insert into t2 values (3, 1, 'xxbuz');
+select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
+ERROR HY000: The table does not have FULLTEXT index to support this query
+select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
+ERROR HY000: The table does not have FULLTEXT index to support this query
+drop table t1,t2;
+create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 (t text character set utf8 not null, fulltext(t)) ENGINE = InnoDB;
+INSERT t1 VALUES ('Mit freundlichem Gr��'), ('aus Osnabr�ck');
+SET NAMES koi8r;
+INSERT t1 VALUES ("��� �� - ������"),("������, �����!"),
+("�� ������, �����!"),("� ����� ����!");
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('������');
+t	collation(t)
+��� �� - ������	utf8_general_ci
+DROP TABLE t1;
+CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) ENGINE = InnoDB DEFAULT CHARSET=utf8;
+insert into t1 (s) values ('p�ra para para'),('para para para');
+select * from t1 where match(s) against('para' in boolean mode);
+s
+para para para
+p�ra para para
+select * from t1 where match(s) against('par*' in boolean mode);
+s
+para para para
+p�ra para para
+DROP TABLE t1;
+CREATE TABLE t1 (h text, FULLTEXT (h)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
+select count(*) from t1;
+count(*)
+1
+drop table t1;
+CREATE TABLE t1 ( a TEXT, FULLTEXT (a) ) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
+SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
+MATCH(a) AGAINST ('nosuchword')
+0
+DROP TABLE t1;
+create table t1 (a int primary key, b text, fulltext(b)) ENGINE = InnoDB;
+create table t2 (a int, b text) ENGINE = InnoDB;
+insert t1 values (1, "aaaa"), (2, "bbbb");
+insert t2 values (10, "aaaa"), (2, "cccc");
+replace t1 select * from t2;
+drop table t1, t2;
+CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t)) ENGINE = InnoDB;
+SET NAMES latin1;
+INSERT INTO t1 VALUES('Mit freundlichem Gr�� aus Osnabr�ck');
+SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr�ck"' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t1 VALUES('testword\'\'');
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
+a
+testword''
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
+a
+INSERT INTO t1 VALUES('test\'s');
+SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE);
+a
+test's
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a)) ENGINE = InnoDB;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(10000) DEFAULT NULL,
+  FULLTEXT KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('test'),('test1'),('test');
+ANALYZE TABLE t1;
+PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+EXECUTE stmt;
+a	FORMAT(MATCH(a) AGAINST('test1 test'),6)
+test1	0.227645
+test	0.031008
+test	0.031008
+EXECUTE stmt;
+a	FORMAT(MATCH(a) AGAINST('test1 test'),6)
+test1	0.227645
+test	0.031008
+test	0.031008
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a)) ENGINE = InnoDB;
+SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test');
+a
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('test');
+a
+DROP TABLE t1;
+CREATE TABLE t1(a TEXT, fulltext(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(' aaaaa aaaa');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
+a
+ aaaaa aaaa
+DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('Offside'),('City Of God');
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE);
+a
+Offside
+City Of God
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city (of*)' IN BOOLEAN MODE);
+a
+Offside
+City Of God
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE);
+a
+Offside
+City Of God
+DROP TABLE t1;
+create table t1(a text,b date,fulltext index(a)) ENGINE = InnoDB;
+insert into t1 set a='water',b='2008-08-04';
+select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01';
+1
+1
+drop table t1;
+show warnings;
+Level	Code	Message
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+('test', 1),('test', 2),('test', 3),('test', 4);
+ANALYZE TABLE t1;
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	b,a	a	0		1	Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	b	NULL	NULL	NULL	8	Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	b	NULL	NULL	NULL	8	Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	b	b	5	const	5	Using where
+DROP TABLE t1;
+CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('aaa15');
+SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
+MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE)
+0.000000001885928302414186
+SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
+MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
+0.000000003771856604828372
+DROP TABLE t1;
+CREATE TABLE t1(a TEXT) ENGINE = InnoDB;
+SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
+ERROR HY000: Incorrect arguments to AGAINST
+DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
+a
+awrd bwrd cwrd
+awrd bwrd cwrd
+awrd bwrd cwrd
+DROP TABLE t1;
+CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col)) ENGINE = InnoDB;
+PREPARE s FROM 
+"SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
+  ;
+EXECUTE s;
+MATCH (col) AGAINST('findme')
+DEALLOCATE PREPARE s;
+DROP TABLE t1;
+#
+# Bug #49250 : spatial btree index corruption and crash
+# Part two : fulltext syntax check
+#
+CREATE TABLE t1(col1 TEXT,
+FULLTEXT INDEX USING BTREE (col1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2
+CREATE TABLE t2(col1 TEXT) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX USING BTREE ON t2(col);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
+ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1
+DROP TABLE t2;
+End of 5.0 tests
+#
+# Bug #47930: MATCH IN BOOLEAN MODE returns too many results 
+#  inside subquery
+#
+CREATE TABLE t1 (a int) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,'Scargill');
+CREATE TABLE t3 (a int, b int) ENGINE = InnoDB;
+INSERT INTO t3 VALUES (1,1), (2,1);
+# t2 should use full text index
+EXPLAIN
+SELECT count(*) FROM t1 WHERE 
+not exists(
+SELECT 1 FROM t2, t3
+WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
+2	DEPENDENT SUBQUERY	t2	fulltext	b2	b2	0		1	Using where
+2	DEPENDENT SUBQUERY	t3	ALL	NULL	NULL	NULL	NULL	2	Using where
+# should return 0
+SELECT count(*) FROM t1 WHERE 
+not exists(
+SELECT 1 FROM t2, t3
+WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+);
+count(*)
+1
+# should return 0
+SELECT count(*) FROM t1 WHERE 
+not exists(
+SELECT 1 FROM t2 IGNORE INDEX (b2), t3
+WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+);
+count(*)
+0
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
+('awrd');
+SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
+COUNT(*)
+0
+DROP TABLE t1;
+#
+# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with 
+#   fulltext search and row op
+#
+CREATE TABLE t1(a CHAR(1),FULLTEXT(a)) ENGINE = InnoDB;
+SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
+1
+DROP TABLE t1;
+#
+# BUG#51866 - crash with repair by sort and fulltext keys
+#
+CREATE TABLE t1(a CHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('aaaa');
+DROP TABLE t1;
+#
+# Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('test');
+SELECT 1 FROM t1 WHERE 1 >
+ALL((SELECT 1 FROM t1 JOIN t1 a
+ON (MATCH(t1.f1) against (""))
+WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+1
+1
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 5.1 tests

=== added file 'mysql-test/suite/innodb_fts/r/fulltext.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,642 @@
+drop table if exists t1,t2,t3;
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+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		
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	100.00	Using where
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections'))
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+select * from t1 where MATCH(a,b) AGAINST ("only");
+a	b
+Only MyISAM tables	support collections
+select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+a	b
+Only MyISAM tables	support collections
+Full-text indexes	are called collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+a	b
+Only MyISAM tables	support collections
+Full-text indexes	are called collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+a	b
+Full-text indexes	are called collections
+Only MyISAM tables	support collections
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QUERY EXPANSION)' at line 1
+explain select * from t1 where MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	Using where
+explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	100.00	Using where
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('support -collections' in boolean mode))
+select * from t1 where MATCH(a,b) AGAINST("support  collections" IN BOOLEAN MODE);
+a	b
+Only MyISAM tables	support collections
+MySQL has now support	for full-text search
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST("support +collections" IN BOOLEAN MODE);
+a	b
+Only MyISAM tables	support collections
+Full-text indexes	are called collections
+select * from t1 where MATCH(a,b) AGAINST("sear*" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Function MATCH ... AGAINST()	is used to do a search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+a	b
+Only MyISAM tables	support collections
+select * from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Function MATCH ... AGAINST()	is used to do a search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+a	b
+Function MATCH ... AGAINST()	is used to do a search
+select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+a	b	x
+MySQL has now support	for full-text search	0.15835624933242798
+Full-text indexes	are called collections	0.15835624933242798
+Only MyISAM tables	support collections	0.31671249866485596
+Function MATCH ... AGAINST()	is used to do a search	0
+Full-text search in MySQL	implements vector space model	0
+select *, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+a	b	x
+MySQL has now support	for full-text search	0.15835624933242798
+Full-text indexes	are called collections	0.15835624933242798
+Only MyISAM tables	support collections	0.31671249866485596
+Function MATCH ... AGAINST()	is used to do a search	0
+Full-text search in MySQL	implements vector space model	0
+select * from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+select * from t1 where MATCH a,b AGAINST ('"now   support"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+select * from t1 where MATCH a,b AGAINST ('"text search"  "now support"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
+a	b
+Full-text search in MySQL	implements vector space model
+select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
+a	b
+MySQL has now support	for full-text search
+select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
+a	b
+select * from t1 where MATCH a,b AGAINST ('+collections -supp* -foobar*' IN BOOLEAN MODE);
+a	b
+Full-text indexes	are called collections
+select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
+a	b
+Full-text search in MySQL	implements vector space model
+delete from t1 where a like "MySQL%";
+update t1 set a='some test foobar' where MATCH a,b AGAINST ('model');
+delete from t1 where MATCH(a,b) AGAINST ("indexes");
+select * from t1;
+a	b
+Only MyISAM tables	support collections
+Function MATCH ... AGAINST()	is used to do a search
+some test foobar	implements vector space model
+drop table t1;
+create table t1 (a varchar(200) not null, fulltext (a)) engine = innodb;
+insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
+select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
+a
+aaa10 bbb20
+aaa20 bbb15
+aaa30 bbb10
+select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
+select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
+a
+select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
+a
+aaa10 bbb20
+select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
+a
+select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
+drop table t1;
+CREATE TABLE t1 (
+id int(11),
+ticket int(11),
+KEY ti (id),
+KEY tit (ticket)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (2,3),(1,2);
+CREATE TABLE t2 (
+ticket int(11),
+inhalt text,
+KEY tig (ticket),
+fulltext index tix (inhalt)
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,'foo'),(2,'bar'),(3,'foobar');
+INSERT INTO t1 VALUES (3,3);
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+select ticket2.id FROM t2 as ttxt,t2
+INNER JOIN t1 as ticket2 ON ticket2.id = t2.ticket
+WHERE ticket2.id = ticket2.ticket and
+match(ttxt.inhalt) against ('foobar');
+id
+3
+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		
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `ticket` int(11) DEFAULT NULL,
+  `inhalt` text,
+  KEY `tig` (`ticket`),
+  FULLTEXT KEY `tix` (`inhalt`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select * from t2 where MATCH inhalt AGAINST (NULL);
+ticket	inhalt
+select * from t2 where  MATCH inhalt AGAINST ('foobar');
+ticket	inhalt
+3	foobar
+select * from t2 having MATCH inhalt AGAINST ('foobar');
+ticket	inhalt
+3	foobar
+CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i));
+ERROR HY000: Column 't' cannot be part of FULLTEXT index
+CREATE TABLE t3 (t int(11),i text,
+j varchar(200) CHARACTER SET latin2,
+fulltext tix (i,j));
+ERROR HY000: Column 'j' cannot be part of FULLTEXT index
+CREATE TABLE t3 (
+ticket int(11),
+inhalt text,
+KEY tig (ticket),
+fulltext index tix (inhalt)
+) ENGINE = InnoDB;
+select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
+ERROR HY000: Incorrect arguments to AGAINST
+select * from t2 where MATCH ticket AGAINST ('foobar');
+ERROR HY000: Can't find FULLTEXT index matching the column list
+select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
+ERROR HY000: Incorrect arguments to MATCH
+drop table t1,t2,t3;
+CREATE TABLE t1 (
+id int(11)  auto_increment,
+title varchar(100)  default '',
+PRIMARY KEY  (id),
+KEY ind5 (title)
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX ft1 ON t1(title);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+insert into t1 (title) values ('this is a test');
+select * from t1 where match title against ('test' in boolean mode);
+id	title
+1	this is a test
+update t1 set title='this is A test' where id=1;
+check table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+update t1 set title='this test once revealed a bug' where id=1;
+select * from t1;
+id	title
+1	this test once revealed a bug
+update t1 set title=NULL where id=1;
+drop table t1;
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE = InnoDB;
+insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
+SELECT * from t1 where MATCH (b) AGAINST ('apples');
+a	b
+insert into t1 values (2,"fullaaa fullzzz");
+select * from t1 where match b against ('full*' in boolean mode);
+a	b
+1	I wonder why the fulltext index doesnt work?
+2	fullaaa fullzzz
+drop table t1;
+CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial');
+select 8 from t1;
+8
+8
+8
+8
+8
+drop table t1;
+create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
+insert into t1 values ('aaaa');
+select * from t1 where match (a) against ('aaaa');
+a
+aaaa
+drop table t1;
+create table t1 ( ref_mag text not null, fulltext (ref_mag)) ENGINE = InnoDB;
+insert into t1 values ('test');
+select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
+ref_mag
+test
+alter table t1 change ref_mag ref_mag char (255) not null;
+select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
+ref_mag
+test
+drop table t1;
+create table t1 (t1_id int(11) primary key, name varchar(32)) ENGINE = InnoDB;
+insert into t1 values (1, 'data1');
+insert into t1 values (2, 'data2');
+create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)) ENGINE = InnoDB;
+insert into t2 values (1, 1, 'xxfoo');
+insert into t2 values (2, 1, 'xxbar');
+insert into t2 values (3, 1, 'xxbuz');
+select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
+ERROR HY000: The table does not have FULLTEXT index to support this query
+select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
+ERROR HY000: The table does not have FULLTEXT index to support this query
+drop table t1,t2;
+create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 (t text character set utf8 not null, fulltext(t)) ENGINE = InnoDB;
+INSERT t1 VALUES ('Mit freundlichem Gr��'), ('aus Osnabr�ck');
+SET NAMES koi8r;
+INSERT t1 VALUES ("��� �� - ������"),("������, �����!"),
+("�� ������, �����!"),("� ����� ����!");
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('������');
+t	collation(t)
+��� �� - ������	utf8_general_ci
+DROP TABLE t1;
+CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) ENGINE = InnoDB DEFAULT CHARSET=utf8;
+insert into t1 (s) values ('p�ra para para'),('para para para');
+select * from t1 where match(s) against('para' in boolean mode);
+s
+para para para
+p�ra para para
+select * from t1 where match(s) against('par*' in boolean mode);
+s
+para para para
+p�ra para para
+DROP TABLE t1;
+CREATE TABLE t1 (h text, FULLTEXT (h)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
+select count(*) from t1;
+count(*)
+1
+drop table t1;
+CREATE TABLE t1 ( a TEXT, FULLTEXT (a) ) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
+SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
+MATCH(a) AGAINST ('nosuchword')
+0
+DROP TABLE t1;
+create table t1 (a int primary key, b text, fulltext(b)) ENGINE = InnoDB;
+create table t2 (a int, b text) ENGINE = InnoDB;
+insert t1 values (1, "aaaa"), (2, "bbbb");
+insert t2 values (10, "aaaa"), (2, "cccc");
+replace t1 select * from t2;
+drop table t1, t2;
+CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t)) ENGINE = InnoDB;
+SET NAMES latin1;
+INSERT INTO t1 VALUES('Mit freundlichem Gr�� aus Osnabr�ck');
+SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr�ck"' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t1 VALUES('testword\'\'');
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
+a
+testword''
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
+a
+INSERT INTO t1 VALUES('test\'s');
+SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE);
+a
+test's
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a)) ENGINE = InnoDB;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(10000) DEFAULT NULL,
+  FULLTEXT KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('test'),('test1'),('test');
+ANALYZE TABLE t1;
+PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+EXECUTE stmt;
+a	FORMAT(MATCH(a) AGAINST('test1 test'),6)
+test1	0.227645
+test	0.031008
+test	0.031008
+EXECUTE stmt;
+a	FORMAT(MATCH(a) AGAINST('test1 test'),6)
+test1	0.227645
+test	0.031008
+test	0.031008
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a)) ENGINE = InnoDB;
+SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test');
+a
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('test');
+a
+DROP TABLE t1;
+CREATE TABLE t1(a TEXT, fulltext(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(' aaaaa aaaa');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
+a
+ aaaaa aaaa
+DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('Offside'),('City Of God');
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE);
+a
+Offside
+City Of God
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city (of*)' IN BOOLEAN MODE);
+a
+Offside
+City Of God
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE);
+a
+Offside
+City Of God
+DROP TABLE t1;
+create table t1(a text,b date,fulltext index(a)) ENGINE = InnoDB;
+insert into t1 set a='water',b='2008-08-04';
+select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01';
+1
+1
+drop table t1;
+show warnings;
+Level	Code	Message
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+('test', 1),('test', 2),('test', 3),('test', 4);
+ANALYZE TABLE t1;
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	b,a	a	0	NULL	1	Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	a	a	0	NULL	1	Using where
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	b	NULL	NULL	NULL	8	Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	b	NULL	NULL	NULL	8	Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	b	b	5	const	5	Using where
+DROP TABLE t1;
+CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('aaa15');
+SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
+MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE)
+0.000000001885928302414186
+SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
+MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
+0.000000003771856604828372
+DROP TABLE t1;
+CREATE TABLE t1(a TEXT) ENGINE = InnoDB;
+SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
+ERROR HY000: Incorrect arguments to AGAINST
+DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
+a
+awrd bwrd cwrd
+awrd bwrd cwrd
+awrd bwrd cwrd
+DROP TABLE t1;
+CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col)) ENGINE = InnoDB;
+PREPARE s FROM 
+"SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
+  ;
+EXECUTE s;
+MATCH (col) AGAINST('findme')
+DEALLOCATE PREPARE s;
+DROP TABLE t1;
+#
+# Bug #49250 : spatial btree index corruption and crash
+# Part two : fulltext syntax check
+#
+CREATE TABLE t1(col1 TEXT,
+FULLTEXT INDEX USING BTREE (col1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1))' at line 2
+CREATE TABLE t2(col1 TEXT) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX USING BTREE ON t2(col);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
+ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1)' at line 1
+DROP TABLE t2;
+End of 5.0 tests
+#
+# Bug #47930: MATCH IN BOOLEAN MODE returns too many results 
+#  inside subquery
+#
+CREATE TABLE t1 (a int) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,'Scargill');
+CREATE TABLE t3 (a int, b int) ENGINE = InnoDB;
+INSERT INTO t3 VALUES (1,1), (2,1);
+# t2 should use full text index
+EXPLAIN
+SELECT count(*) FROM t1 WHERE 
+not exists(
+SELECT 1 FROM t2, t3
+WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
+2	DEPENDENT SUBQUERY	t2	fulltext	b2	b2	0	NULL	1	Using where
+2	DEPENDENT SUBQUERY	t3	ALL	NULL	NULL	NULL	NULL	2	Using where
+# should return 0
+SELECT count(*) FROM t1 WHERE 
+not exists(
+SELECT 1 FROM t2, t3
+WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+);
+count(*)
+1
+# should return 0
+SELECT count(*) FROM t1 WHERE 
+not exists(
+SELECT 1 FROM t2 IGNORE INDEX (b2), t3
+WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+);
+count(*)
+0
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
+('awrd');
+SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
+COUNT(*)
+0
+DROP TABLE t1;
+#
+# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with 
+#   fulltext search and row op
+#
+CREATE TABLE t1(a CHAR(1),FULLTEXT(a)) ENGINE = InnoDB;
+SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
+1
+DROP TABLE t1;
+#
+# BUG#51866 - crash with repair by sort and fulltext keys
+#
+CREATE TABLE t1(a CHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('aaaa');
+DROP TABLE t1;
+#
+# Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('test');
+SELECT 1 FROM t1 WHERE 1 >
+ALL((SELECT 1 FROM t1 JOIN t1 a
+ON (MATCH(t1.f1) against (""))
+WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+1
+1
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 5.1 tests

=== added file 'mysql-test/suite/innodb_fts/r/fulltext2.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext2.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext2.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,256 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+i int(10) unsigned not null auto_increment primary key,
+a varchar(255) not null,
+FULLTEXT KEY (a)
+) ENGINE = INNODB;
+Warnings:
+Warning	1286	Unknown storage engine 'INNODB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+check table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+count(*)
+765
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+count(*)
+765
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+count(*)
+765
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+260
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+0
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+0
+select count(*) from t1 where a = 'aaaxxx';
+count(*)
+261
+select count(*) from t1 where a = 'aaayyy';
+count(*)
+251
+select count(*) from t1 where a = 'aaazzz';
+count(*)
+0
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+1
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+0
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+262
+drop table t1;
+CREATE TABLE t1 (
+i int(10) unsigned not null auto_increment primary key,
+a varchar(255) not null,
+FULLTEXT KEY (a)
+) ENGINE = INNODB;
+Warnings:
+Warning	1286	Unknown storage engine 'INNODB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+count(*)
+765
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+count(*)
+765
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+count(*)
+765
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+260
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+0
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+0
+select count(*) from t1 where a = 'aaaxxx';
+count(*)
+261
+select count(*) from t1 where a = 'aaayyy';
+count(*)
+251
+select count(*) from t1 where a = 'aaazzz';
+count(*)
+0
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+1
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+0
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+262
+drop table t1;
+set names utf8;
+create table t1(a text,fulltext(a)) ENGINE = INNODB collate=utf8_swedish_ci;
+Warnings:
+Warning	1286	Unknown storage engine 'INNODB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+insert into t1 values('test test��'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
+delete from t1 limit 1;
+truncate table t1;
+insert into t1 values('ab��c d');
+update t1 set a='ab c d';
+select * from t1 where match a against('ab c' in boolean mode);
+a
+select * from t1 where match a against('ab	c' in boolean mode);
+a
+drop table t1;
+set names latin1;
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE = INNODB DEFAULT CHARSET=utf8;
+Warnings:
+Warning	1286	Unknown storage engine 'INNODB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES('���MySQL���');
+SELECT a FROM t1 WHERE MATCH a AGAINST('���MySQL���' IN BOOLEAN MODE);
+a
+���MySQL���
+DROP TABLE t1;
+SET NAMES latin1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext2.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext2.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext2.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,243 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+i int(10) unsigned not null auto_increment primary key,
+a varchar(255) not null,
+FULLTEXT KEY (a)
+) ENGINE = INNODB;
+check table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+count(*)
+765
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+count(*)
+765
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+count(*)
+765
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+260
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+0
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+0
+select count(*) from t1 where a = 'aaaxxx';
+count(*)
+261
+select count(*) from t1 where a = 'aaayyy';
+count(*)
+251
+select count(*) from t1 where a = 'aaazzz';
+count(*)
+0
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+1
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+0
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+262
+drop table t1;
+CREATE TABLE t1 (
+i int(10) unsigned not null auto_increment primary key,
+a varchar(255) not null,
+FULLTEXT KEY (a)
+) ENGINE = INNODB;
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+count(*)
+765
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+count(*)
+765
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+count(*)
+765
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+260
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+0
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+0
+select count(*) from t1 where a = 'aaaxxx';
+count(*)
+261
+select count(*) from t1 where a = 'aaayyy';
+count(*)
+251
+select count(*) from t1 where a = 'aaazzz';
+count(*)
+0
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+1
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+0
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+262
+drop table t1;
+set names utf8;
+create table t1(a text,fulltext(a)) ENGINE = INNODB collate=utf8_swedish_ci;
+insert into t1 values('test test��'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
+delete from t1 limit 1;
+truncate table t1;
+insert into t1 values('ab��c d');
+update t1 set a='ab c d';
+select * from t1 where match a against('ab c' in boolean mode);
+a
+select * from t1 where match a against('ab	c' in boolean mode);
+a
+drop table t1;
+set names latin1;
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE = INNODB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('���MySQL���');
+SELECT a FROM t1 WHERE MATCH a AGAINST('���MySQL���' IN BOOLEAN MODE);
+a
+DROP TABLE t1;
+SET NAMES latin1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext3.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext3.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext3.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,12 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a)) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+SET NAMES utf8;
+DELETE FROM t1 LIMIT 1;
+SET NAMES latin1;
+DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
+FULLTEXT(a)) ENGINE=<default_engine>;
+DROP TABLE t1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext3.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext3.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext3.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,9 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a)) ENGINE = InnoDB;
+SET NAMES utf8;
+DELETE FROM t1 LIMIT 1;
+SET NAMES latin1;
+DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
+FULLTEXT(a)) ENGINE=<default_engine>;
+DROP TABLE t1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_cache.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_cache.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_cache.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,70 @@
+drop table if exists t1, t2;
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL auto_increment,
+q varchar(255) default NULL,
+PRIMARY KEY (id)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'aaaaaaaaa dsaass de');
+INSERT INTO t1 VALUES (2,'ssde df s fsda sad er');
+CREATE TABLE t2 (
+id int(10) unsigned NOT NULL auto_increment,
+id2 int(10) unsigned default NULL,
+item varchar(255) default NULL,
+PRIMARY KEY (id),
+FULLTEXT KEY item(item)
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,1,'sushi');
+INSERT INTO t2 VALUES (2,1,'Bolo de Chocolate');
+INSERT INTO t2 VALUES (3,1,'Feijoada');
+INSERT INTO t2 VALUES (4,1,'Mousse de Chocolate');
+INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
+INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
+INSERT INTO t2 VALUES (7,1,'Bife');
+INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
+as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+q	item	id	x
+aaaaaaaaa dsaass de	sushi	1	0.815572
+aaaaaaaaa dsaass de	Bolo de Chocolate	2	0.000000
+aaaaaaaaa dsaass de	Feijoada	3	0.000000
+aaaaaaaaa dsaass de	Mousse de Chocolate	4	0.000000
+ssde df s fsda sad er	um copo de Vodka	5	0.000000
+ssde df s fsda sad er	um chocolate Snickers	6	0.000000
+aaaaaaaaa dsaass de	Bife	7	0.000000
+aaaaaaaaa dsaass de	Pizza de Salmao	8	0.000000
+SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
+as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+q	item	id	x
+aaaaaaaaa dsaass de	sushi	1	0.8155715465545654
+aaaaaaaaa dsaass de	Bolo de Chocolate	2	0
+aaaaaaaaa dsaass de	Feijoada	3	0
+aaaaaaaaa dsaass de	Mousse de Chocolate	4	0
+ssde df s fsda sad er	um copo de Vodka	5	0
+ssde df s fsda sad er	um chocolate Snickers	6	0
+aaaaaaaaa dsaass de	Bife	7	0
+aaaaaaaaa dsaass de	Pizza de Salmao	8	0
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
+as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+q	item	id	x
+aaaaaaaaa dsaass de	sushi	1	0.815572
+aaaaaaaaa dsaass de	Bolo de Chocolate	2	0.000000
+aaaaaaaaa dsaass de	Feijoada	3	0.000000
+aaaaaaaaa dsaass de	Mousse de Chocolate	4	0.000000
+ssde df s fsda sad er	um copo de Vodka	5	0.000000
+ssde df s fsda sad er	um chocolate Snickers	6	0.000000
+aaaaaaaaa dsaass de	Bife	7	0.000000
+aaaaaaaaa dsaass de	Pizza de Salmao	8	0.000000
+SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
+as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+q	item	id	x
+aaaaaaaaa dsaass de	sushi	1	0.8155715465545654
+aaaaaaaaa dsaass de	Bolo de Chocolate	2	0
+aaaaaaaaa dsaass de	Feijoada	3	0
+aaaaaaaaa dsaass de	Mousse de Chocolate	4	0
+ssde df s fsda sad er	um copo de Vodka	5	0
+ssde df s fsda sad er	um chocolate Snickers	6	0
+aaaaaaaaa dsaass de	Bife	7	0
+aaaaaaaaa dsaass de	Pizza de Salmao	8	0
+drop table t1, t2;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_distinct.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_distinct.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_distinct.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,45 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+id mediumint unsigned NOT NULL auto_increment,
+tag char(6) NOT NULL default '',
+value text NOT NULL default '',
+PRIMARY KEY (id),
+KEY kt(tag),
+KEY kv(value(15)),
+FULLTEXT KEY kvf(value)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1101	BLOB/TEXT column 'value' can't have a default value
+CREATE TABLE t2 (
+id_t2 mediumint unsigned NOT NULL default '0',
+id_t1 mediumint unsigned NOT NULL default '0',
+field_number tinyint unsigned NOT NULL default '0',
+PRIMARY KEY (id_t2,id_t1,field_number),
+KEY id_t1(id_t1)
+) ENGINE = InnoDB;
+INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
+INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
+INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar');
+INSERT INTO t2 VALUES (2231626,64280,0);
+INSERT INTO t2 VALUES (2231626,64281,0);
+INSERT INTO t2 VALUES (12346, 3, 1);
+SELECT * FROM t1;
+id	tag	value
+1	foo123	bar111
+2	foo123	bar222
+3	bar345	baz333 ar
+SELECT * FROM t2;
+id_t2	id_t1	field_number
+12346	3	1
+2231626	64280	0
+2231626	64281	0
+SELECT DISTINCT t2.id_t2 FROM t2, t1
+WHERE MATCH (t1.value) AGAINST ('baz333') AND t1.id = t2.id_t1;
+id_t2
+12346
+SELECT DISTINCT t2.id_t2 FROM t2, t1
+WHERE MATCH (t1.value) AGAINST ('baz333' IN BOOLEAN MODE)
+AND t1.id = t2.id_t1;
+id_t2
+12346
+DROP TABLE t1, t2;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_left_join.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext_left_join.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_left_join.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,139 @@
+drop table if exists t1, t2;
+CREATE TABLE t1 (
+id           VARCHAR(255) NOT NULL PRIMARY KEY,
+sujet        VARCHAR(255),
+motsclefs    TEXT,
+texte        MEDIUMTEXT,
+FULLTEXT(sujet, motsclefs, texte)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES('123','toto','essai','test');
+INSERT INTO t1 VALUES('456','droit','penal','lawyer');
+INSERT INTO t1 VALUES('789','aaaaa','bbbbb','cccccc');
+CREATE TABLE t2 (
+id         VARCHAR(255) NOT NULL,
+author     VARCHAR(255) NOT NULL
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't2'
+INSERT INTO t2 VALUES('123', 'moi');
+INSERT INTO t2 VALUES('123', 'lui');
+INSERT INTO t2 VALUES('456', 'lui');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+from t1 left join t2 on t2.id=t1.id;
+round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+0.00000
+0.00000
+0.67003
+0.00000
+select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
+from t1 left join t2 on t2.id=t1.id;
+match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
+0
+0
+1
+0
+drop table t1, t2;
+create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00');
+create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key  (entity_id), fulltext key name (name)) engine= innodb;
+Warnings:
+Warning	1286	Unknown storage engine 'innodb'
+Warning	1266	Using storage engine MyISAM for table 't2'
+insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+NULL	a2	2003-05-23 19:30:00	NULL	NULL
+select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+NULL	a2	2003-05-23 19:30:00	NULL	NULL
+drop table t1,t2;
+create table t1 (id int not null primary key, d char(200) not null, e char(200), fulltext (d, e)) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null);
+ANALYZE TABLE t1;
+select * from t1 where match(d, e) against ('+aword +bword' in boolean mode);
+id	d	e
+2	aword	bword
+4	bword	aword
+5	aword and bword	NULL
+create table t2 (m_id int not null, f char(200), key (m_id), fulltext (f)) engine = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't2'
+insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
+ANALYZE TABLE t2;
+select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
+id	d	e	m_id	f
+1	aword	NULL	1	bword
+2	aword	bword	NULL	NULL
+3	bword	NULL	3	aword
+4	bword	aword	NULL	NULL
+5	aword and bword	NULL	5	
+drop table t1,t2;
+CREATE TABLE t1 (
+id int(10) NOT NULL auto_increment,
+link int(10) default NULL,
+name mediumtext default NULL,
+PRIMARY KEY (id),
+FULLTEXT (name)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES (1, 1, 'string');
+INSERT INTO t1 VALUES (2, 0, 'string');
+CREATE TABLE t2 (
+id int(10) NOT NULL auto_increment,
+name mediumtext default NULL,
+PRIMARY KEY (id),
+FULLTEXT (name)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't2'
+INSERT INTO t2 VALUES (1, 'string');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance 
+FROM t1 LEFT JOIN t2 ON t1.link = t2.id
+WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
+id	link	name	relevance
+1	1	string	0
+2	0	string	0
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't2'
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+a	b	c
+DROP TABLE t1, t2;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_left_join.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_left_join.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_left_join.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,104 @@
+drop table if exists t1, t2;
+CREATE TABLE t1 (
+id           VARCHAR(255) NOT NULL PRIMARY KEY,
+sujet        VARCHAR(255),
+motsclefs    TEXT,
+texte        MEDIUMTEXT,
+FULLTEXT(sujet, motsclefs, texte)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('123','toto','essai','test');
+INSERT INTO t1 VALUES('456','droit','penal','lawyer');
+INSERT INTO t1 VALUES('789','aaaaa','bbbbb','cccccc');
+CREATE TABLE t2 (
+id         VARCHAR(255) NOT NULL,
+author     VARCHAR(255) NOT NULL
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES('123', 'moi');
+INSERT INTO t2 VALUES('123', 'lui');
+INSERT INTO t2 VALUES('456', 'lui');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+from t1 left join t2 on t2.id=t1.id;
+round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+0.00000
+0.00000
+0.22764
+0.00000
+select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
+from t1 left join t2 on t2.id=t1.id;
+match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
+0
+0
+0.22764469683170319
+0
+drop table t1, t2;
+create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) ENGINE = InnoDB;
+insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00');
+create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key  (entity_id), fulltext key name (name)) engine= innodb;
+insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+NULL	a2	2003-05-23 19:30:00	NULL	NULL
+select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
+venue_id	venue_text	dt	name	entity_id
+1	a1	2003-05-23 19:30:00	aberdeen town hall	1
+NULL	a2	2003-05-23 19:30:00	NULL	NULL
+drop table t1,t2;
+create table t1 (id int not null primary key, d char(200) not null, e char(200), fulltext (d, e)) ENGINE = InnoDB;
+insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null);
+ANALYZE TABLE t1;
+select * from t1 where match(d, e) against ('+aword +bword' in boolean mode);
+id	d	e
+2	aword	bword
+4	bword	aword
+5	aword and bword	NULL
+create table t2 (m_id int not null, f char(200), key (m_id), fulltext (f)) engine = InnoDB;
+insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
+ANALYZE TABLE t2;
+select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
+id	d	e	m_id	f
+drop table t1,t2;
+CREATE TABLE t1 (
+id int(10) NOT NULL auto_increment,
+link int(10) default NULL,
+name mediumtext default NULL,
+PRIMARY KEY (id),
+FULLTEXT (name)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1, 1, 'string');
+INSERT INTO t1 VALUES (2, 0, 'string');
+CREATE TABLE t2 (
+id int(10) NOT NULL auto_increment,
+name mediumtext default NULL,
+PRIMARY KEY (id),
+FULLTEXT (name)
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1, 'string');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance 
+FROM t1 LEFT JOIN t2 ON t1.link = t2.id
+WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
+id	link	name	relevance
+1	1	string	0.000000001885928302414186
+2	0	string	0.000000001885928302414186
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT) ENGINE = InnoDB;
+CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+a	b	c
+DROP TABLE t1, t2;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_misc.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_misc.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_misc.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,188 @@
+drop table if exists t1;
+#
+# Bug#56814 Explain + subselect + fulltext crashes server
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,FULLTEXT KEY(f1),UNIQUE(f1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('test');
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	f1_2	8	NULL	1	Using index
+2	SUBQUERY	t1	fulltext	f1	f1	0	NULL	1	Using where
+2	SUBQUERY	a	index	NULL	f1_2	8	NULL	1	Using index
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	f1_2	8	NULL	1	Using index
+2	SUBQUERY	t1	fulltext	f1	f1	0	NULL	1	Using where
+2	SUBQUERY	a	index	NULL	f1_2	8	NULL	1	Using index
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	f1_2	8	NULL	1	Using index
+2	SUBQUERY	t1	fulltext	f1	f1	0	NULL	1	Using where
+2	SUBQUERY	a	index	NULL	f1_2	8	NULL	1	Using index
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	f1_2	8	NULL	1	Using index
+2	SUBQUERY	t1	fulltext	f1	f1	0	NULL	1	Using where
+2	SUBQUERY	a	index	NULL	f1_2	8	NULL	1	Using index
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	f1_2	8	NULL	1	Using index
+2	SUBQUERY	t1	fulltext	f1	f1	0	NULL	1	Using where
+2	SUBQUERY	a	index	NULL	f1_2	8	NULL	1	Using index
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+drop table if exists t1;
+CREATE TABLE t1 (
+kodoboru varchar(10) default NULL,
+obor tinytext,
+aobor tinytext,
+UNIQUE INDEX kodoboru (kodoboru),
+FULLTEXT KEY obor (obor),
+FULLTEXT KEY aobor (aobor)
+) ENGINE = InnoDB;
+drop table t1;
+CREATE TABLE t1 (
+kodoboru varchar(10) default NULL,
+obor tinytext,
+aobor tinytext,
+UNIQUE INDEX kodoboru (kodoboru),
+FULLTEXT KEY obor (obor)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('0101000000','aaa','AAA');
+INSERT INTO t1 VALUES ('0102000000','bbb','BBB');
+INSERT INTO t1 VALUES ('0103000000','ccc','CCC');
+INSERT INTO t1 VALUES ('0104000000','xxx','XXX');
+select * from t1;
+kodoboru	obor	aobor
+0101000000	aaa	AAA
+0102000000	bbb	BBB
+0103000000	ccc	CCC
+0104000000	xxx	XXX
+drop table t1;
+create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
+c7 int, c8 int, c9 int, fulltext key (`c1`)) ENGINE = InnoDB;
+select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8
+from t1 where c9=1 order by c2, c2;
+match (`c1`) against ('z')	c2	c3	c4	c5	c6	c7	c8
+drop table t1;
+CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2)) ENGINE = InnoDB;
+insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer');
+select * from t1 WHERE match (c2) against ('Beer');
+c1	c2
+1	real Beer
+7	almost real Beer
+CREATE VIEW v1 AS SELECT  * from t1 WHERE match (c2) against ('Beer');
+select * from v1;
+c1	c2
+1	real Beer
+7	almost real Beer
+drop view v1;
+drop table t1;
+create table t1 (mytext text, FULLTEXT (mytext)) ENGINE = InnoDB;
+insert t1 values ('aaabbb');
+check table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+check table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+drop table t1;
+create table t1 (a varchar(10), fulltext key(a)) ENGINE = InnoDB;
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+hex(concat(match (a) against ('a')))
+30
+create table t2 ENGINE = InnoDB as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` varchar(23) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1, t2;
+CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('abcd');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
+ERROR HY000: The table does not have FULLTEXT index to support this query
+DROP TABLE t1;
+create table t1 (a varchar(10), key(a), fulltext (a)) ENGINE = InnoDB;
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+select * from t1 where a like "abc%";
+a
+abc
+abcd
+select * from t1 where a like "test%";
+a
+test
+select * from t1 where a like "te_t";
+a
+test
+select * from t1 where match a against ("te*" in boolean mode)+0;
+a
+drop table t1;
+# 
+# Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY 
+#   <any non-const-function>
+# 
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1),(2);
+# Should not crash
+EXPLAIN EXTENDED
+SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
+2	UNION	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
+NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using temporary; Using filesort
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (`a` + 12)
+# Should not crash
+SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
+a
+1
+2
+# Should not crash
+EXPLAIN EXTENDED
+SELECT * FROM t1 UNION SELECT * FROM t1
+ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+# Should not crash
+SELECT * FROM t1 UNION SELECT * FROM t1
+ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+# Should not crash
+EXPLAIN EXTENDED
+SELECT * FROM t1 UNION SELECT * FROM t1
+ORDER BY (SELECT a FROM t2 WHERE b = 12);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
+2	UNION	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
+3	DEPENDENT SUBQUERY	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
+NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using temporary; Using filesort
+Warnings:
+Note	1276	Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
+Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (/* select#3 */ select `test`.`t1`.`a` from `test`.`t2` where (`test`.`t2`.`b` = 12))
+# Should not crash
+SELECT * FROM t1 UNION SELECT * FROM t1
+ORDER BY (SELECT a FROM t2 WHERE b = 12);
+# Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+b
+1
+2
+DROP TABLE t1,t2;
+End of 5.1 tests

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_multi.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext_multi.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_multi.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,44 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a int(11) NOT NULL auto_increment,
+b text,
+c varchar(254) default NULL,
+PRIMARY KEY (a),
+FULLTEXT KEY bb(b),
+FULLTEXT KEY cc(c),
+FULLTEXT KEY a(b,c)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+drop table t1;
+CREATE TABLE t1 (
+a int(11) NOT NULL auto_increment,
+b text,
+c varchar(254) default NULL,
+PRIMARY KEY (a),
+FULLTEXT KEY a(b,c)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
+INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
+INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
+ANALYZE TABLE t1;
+SELECT a, round(MATCH  b,c AGAINST ('lala lkjh'),5) FROM t1;
+a	round(MATCH  b,c AGAINST ('lala lkjh'),5)
+1	0.64841
+2	0.66266
+3	0.00000
+SELECT a, round(MATCH  c,c AGAINST ('lala lkjh'),5) FROM t1;
+a	round(MATCH  c,c AGAINST ('lala lkjh'),5)
+1	0.64841
+2	0.66266
+3	0.00000
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
+a	round(MATCH b,c AGAINST ('lala lkjh'),5)
+1	0.64841
+2	0.66266
+3	0.00000
+drop table t1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_multi.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_multi.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_multi.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,38 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a int(11) NOT NULL auto_increment,
+b text,
+c varchar(254) default NULL,
+PRIMARY KEY (a),
+FULLTEXT KEY bb(b),
+FULLTEXT KEY cc(c),
+FULLTEXT KEY a(b,c)
+) ENGINE = InnoDB;
+drop table t1;
+CREATE TABLE t1 (
+a int(11) NOT NULL auto_increment,
+b text,
+c varchar(254) default NULL,
+PRIMARY KEY (a),
+FULLTEXT KEY a(b,c)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
+INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
+INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
+ANALYZE TABLE t1;
+SELECT a, round(MATCH  b,c AGAINST ('lala lkjh'),5) FROM t1;
+a	round(MATCH  b,c AGAINST ('lala lkjh'),5)
+1	0.22764
+2	0.22764
+3	0.00000
+SELECT a, round(MATCH  c,c AGAINST ('lala lkjh'),5) FROM t1;
+a	round(MATCH  c,c AGAINST ('lala lkjh'),5)
+1	0.22764
+2	0.22764
+3	0.00000
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
+a	round(MATCH b,c AGAINST ('lala lkjh'),5)
+1	0.22764
+2	0.22764
+3	0.00000
+drop table t1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_order_by.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext_order_by.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_order_by.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,194 @@
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1 (
+a INT AUTO_INCREMENT PRIMARY KEY,
+message CHAR(20),
+FULLTEXT(message)
+) ENGINE = InnoDB comment = 'original testcase by sroussey at network54.com';
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
+("steve"),("is"),("cool"),("steve is cool");
+ANALYZE TABLE t1;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+4	0.905873
+7	0.895690
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+4	1
+7	1
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+4	0.905873
+7	0.895690
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+4	1
+7	1
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+4	0.905873
+7	0.895690
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+4	1
+7	1
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+7	0.895690
+4	0.905873
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+7	1
+4	1
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+7	0.895690
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+7	1
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
+a	rel
+1	0.000000
+5	0.000000
+2	0.000000
+6	0.000000
+3	0.000000
+7	0.895690
+4	0.905873
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
+a	rel
+1	0
+2	0
+3	0
+5	0
+6	0
+4	1
+7	1
+alter table t1 add key m (message);
+ANALYZE TABLE t1;
+explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	message	message	0		1	Using where; Using filesort
+SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc;
+message
+steve is cool
+steve
+drop table t1;
+CREATE TABLE t1 (
+a INT AUTO_INCREMENT PRIMARY KEY,
+message CHAR(20),
+FULLTEXT(message)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
+ANALYZE TABLE t1;
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
+a	rel
+1	1
+2	2
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
+a	rel
+1	1
+2	2
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+thread int(11) NOT NULL default '0',
+beitrag longtext NOT NULL,
+PRIMARY KEY  (id),
+KEY thread (thread),
+FULLTEXT KEY beitrag (beitrag)
+) ENGINE =InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7923 ;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+CREATE TABLE t2 (
+id int(11) NOT NULL auto_increment,
+text varchar(100) NOT NULL default '',
+PRIMARY KEY  (id),
+KEY text (text)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't2'
+CREATE TABLE t3 (
+id int(11) NOT NULL auto_increment,
+forum int(11) NOT NULL default '0',
+betreff varchar(70) NOT NULL default '',
+PRIMARY KEY  (id),
+KEY forum (forum),
+FULLTEXT KEY betreff (betreff)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't3'
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(b.betreff) against ('+abc' in boolean mode)
+group by a.text, b.id, b.betreff
+union
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(c.beitrag) against ('+abc' in boolean mode)
+group by 
+a.text, b.id, b.betreff
+order by 
+match(b.betreff) against ('+abc' in boolean mode) desc;
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(b.betreff) against ('+abc' in boolean mode)
+union
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(c.beitrag) against ('+abc' in boolean mode)
+order by 
+match(b.betreff) against ('+abc' in boolean mode) desc;
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(b.betreff) against ('+abc' in boolean mode)
+union
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(c.beitrag) against ('+abc' in boolean mode)
+order by 
+match(betreff) against ('+abc' in boolean mode) desc;
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+(select b.id, b.betreff from t3 b) union 
+(select b.id, b.betreff from t3 b) 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id	betreff
+(select b.id, b.betreff from t3 b) union 
+(select b.id, b.betreff from t3 b) 
+order by match(betreff) against ('+abc') desc;
+ERROR HY000: Can't find FULLTEXT index matching the column list
+select distinct b.id, b.betreff from t3 b 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id	betreff
+select b.id, b.betreff from t3 b group by b.id+1 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id	betreff
+drop table t1,t2,t3;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_order_by.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_order_by.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_order_by.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,179 @@
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1 (
+a INT AUTO_INCREMENT PRIMARY KEY,
+message CHAR(20),
+FULLTEXT(message)
+) ENGINE = InnoDB comment = 'original testcase by sroussey at network54.com';
+INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
+("steve"),("is"),("cool"),("steve is cool");
+ANALYZE TABLE t1;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+4	0.296010
+7	0.296010
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+4	0.2960100471973419
+7	0.2960100471973419
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+4	0.296010
+7	0.296010
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+4	0.2960100471973419
+7	0.2960100471973419
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+4	0.296010
+7	0.296010
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+4	0.2960100471973419
+7	0.2960100471973419
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+7	0.296010
+4	0.296010
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+7	0.2960100471973419
+4	0.2960100471973419
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+a	FORMAT(MATCH (message) AGAINST ('steve'),6)
+7	0.296010
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
+a	MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
+7	0.2960100471973419
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
+a	rel
+1	0.000000
+2	0.000000
+3	0.000000
+5	0.000000
+6	0.000000
+4	0.296010
+7	0.296010
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
+a	rel
+1	0
+2	0
+3	0
+5	0
+6	0
+4	0.2960100471973419
+7	0.2960100471973419
+alter table t1 add key m (message);
+ANALYZE TABLE t1;
+explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	fulltext	message	message	0	NULL	1	Using where; Using filesort
+SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc;
+message
+steve is cool
+steve
+drop table t1;
+CREATE TABLE t1 (
+a INT AUTO_INCREMENT PRIMARY KEY,
+message CHAR(20),
+FULLTEXT(message)
+) ENGINE = InnoDB;
+INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
+ANALYZE TABLE t1;
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
+a	rel
+1	0.000000001885928302414186
+2	0.0906190574169159
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
+a	rel
+1	0.000000001885928302414186
+2	0.0906190574169159
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+thread int(11) NOT NULL default '0',
+beitrag longtext NOT NULL,
+PRIMARY KEY  (id),
+KEY thread (thread),
+FULLTEXT KEY beitrag (beitrag)
+) ENGINE =InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7923 ;
+CREATE TABLE t2 (
+id int(11) NOT NULL auto_increment,
+text varchar(100) NOT NULL default '',
+PRIMARY KEY  (id),
+KEY text (text)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ;
+CREATE TABLE t3 (
+id int(11) NOT NULL auto_increment,
+forum int(11) NOT NULL default '0',
+betreff varchar(70) NOT NULL default '',
+PRIMARY KEY  (id),
+KEY forum (forum),
+FULLTEXT KEY betreff (betreff)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ;
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(b.betreff) against ('+abc' in boolean mode)
+group by a.text, b.id, b.betreff
+union
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(c.beitrag) against ('+abc' in boolean mode)
+group by 
+a.text, b.id, b.betreff
+order by 
+match(b.betreff) against ('+abc' in boolean mode) desc;
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(b.betreff) against ('+abc' in boolean mode)
+union
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(c.beitrag) against ('+abc' in boolean mode)
+order by 
+match(b.betreff) against ('+abc' in boolean mode) desc;
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(b.betreff) against ('+abc' in boolean mode)
+union
+select a.text, b.id, b.betreff
+from 
+t2 a inner join t3 b on a.id = b.forum inner join
+t1 c on b.id = c.thread
+where 
+match(c.beitrag) against ('+abc' in boolean mode)
+order by 
+match(betreff) against ('+abc' in boolean mode) desc;
+ERROR 42000: Incorrect usage/placement of 'MATCH()'
+(select b.id, b.betreff from t3 b) union 
+(select b.id, b.betreff from t3 b) 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id	betreff
+(select b.id, b.betreff from t3 b) union 
+(select b.id, b.betreff from t3 b) 
+order by match(betreff) against ('+abc') desc;
+ERROR HY000: Can't find FULLTEXT index matching the column list
+select distinct b.id, b.betreff from t3 b 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id	betreff
+select b.id, b.betreff from t3 b group by b.id+1 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id	betreff
+drop table t1,t2,t3;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_update.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext_update.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_update.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,26 @@
+drop table if exists test;
+CREATE TABLE test (
+gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+url VARCHAR(80) DEFAULT '' NOT NULL,
+shortdesc VARCHAR(200) DEFAULT '' NOT NULL,
+longdesc text DEFAULT '' NOT NULL,
+description VARCHAR(80) DEFAULT '' NOT NULL,
+name VARCHAR(80) DEFAULT '' NOT NULL,
+FULLTEXT(url,description,shortdesc,longdesc),
+PRIMARY KEY(gnr)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1101	BLOB/TEXT column 'longdesc' can't have a default value
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 'test'
+insert into test (url,shortdesc,longdesc,description,name) VALUES 
+("http:/test.at", "kurz", "lang","desc", "name");
+insert into test (url,shortdesc,longdesc,description,name) VALUES 
+("http:/test.at", "kurz", "","desc", "name");
+update test set url='test', description='ddd', name='nam' where gnr=2;
+update test set url='test', shortdesc='ggg', longdesc='mmm', 
+description='ddd', name='nam' where gnr=2;
+check table test;
+Table	Op	Msg_type	Msg_text
+test.test	check	status	OK
+drop table test;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_update.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_update.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_update.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,24 @@
+drop table if exists test;
+CREATE TABLE test (
+gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+url VARCHAR(80) DEFAULT '' NOT NULL,
+shortdesc VARCHAR(200) DEFAULT '' NOT NULL,
+longdesc text DEFAULT '' NOT NULL,
+description VARCHAR(80) DEFAULT '' NOT NULL,
+name VARCHAR(80) DEFAULT '' NOT NULL,
+FULLTEXT(url,description,shortdesc,longdesc),
+PRIMARY KEY(gnr)
+) ENGINE = InnoDB;
+Warnings:
+Warning	1101	BLOB/TEXT column 'longdesc' can't have a default value
+insert into test (url,shortdesc,longdesc,description,name) VALUES 
+("http:/test.at", "kurz", "lang","desc", "name");
+insert into test (url,shortdesc,longdesc,description,name) VALUES 
+("http:/test.at", "kurz", "","desc", "name");
+update test set url='test', description='ddd', name='nam' where gnr=2;
+update test set url='test', shortdesc='ggg', longdesc='mmm', 
+description='ddd', name='nam' where gnr=2;
+check table test;
+Table	Op	Msg_type	Msg_text
+test.test	check	status	OK
+drop table test;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_var.reject'
--- a/mysql-test/suite/innodb_fts/r/fulltext_var.reject	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_var.reject	2013-08-07 09:55:00 +0000
@@ -0,0 +1,41 @@
+drop table if exists t1;
+show variables like "ft\_%";
+Variable_name	Value
+ft_boolean_syntax	+ -><()~*:""&|
+ft_max_word_len	84
+ft_min_word_len	4
+ft_query_expansion_limit	20
+ft_stopword_file	(built-in)
+create table t1 (b text not null, fulltext(b)) engine = innodb;
+Warnings:
+Warning	1286	Unknown storage engine 'innodb'
+Warning	1266	Using storage engine MyISAM for table 't1'
+insert t1 values ('aaaaaa bbbbbb cccccc');
+insert t1 values ('bbbbbb cccccc');
+insert t1 values ('aaaaaa cccccc');
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+aaaaaa cccccc
+set ft_boolean_syntax=' +-><()~*:""&|';
+ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
+set global ft_boolean_syntax=' +-><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+set global ft_boolean_syntax='@ -><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+aaaaaa cccccc
+select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+set global ft_boolean_syntax='@ -><()~*:""@|';
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '@ -><()~*:""@|'
+set global ft_boolean_syntax='+ -><()~*:""@!|';
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '+ -><()~*:""@!|'
+drop table t1;

=== added file 'mysql-test/suite/innodb_fts/r/fulltext_var.result'
--- a/mysql-test/suite/innodb_fts/r/fulltext_var.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/fulltext_var.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,38 @@
+drop table if exists t1;
+show variables like "ft\_%";
+Variable_name	Value
+ft_boolean_syntax	+ -><()~*:""&|
+ft_max_word_len	84
+ft_min_word_len	4
+ft_query_expansion_limit	20
+ft_stopword_file	(built-in)
+create table t1 (b text not null, fulltext(b)) engine = innodb;
+insert t1 values ('aaaaaa bbbbbb cccccc');
+insert t1 values ('bbbbbb cccccc');
+insert t1 values ('aaaaaa cccccc');
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+aaaaaa cccccc
+set ft_boolean_syntax=' +-><()~*:""&|';
+ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
+set global ft_boolean_syntax=' +-><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+aaaaaa cccccc
+set global ft_boolean_syntax='@ -><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+aaaaaa cccccc
+select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
+b
+set global ft_boolean_syntax='@ -><()~*:""@|';
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '@ -><()~*:""@|'
+set global ft_boolean_syntax='+ -><()~*:""@!|';
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '+ -><()~*:""@!|'
+drop table t1;

=== added file 'mysql-test/suite/innodb_fts/r/innobase_drop_fts_index_table.result'
--- a/mysql-test/suite/innodb_fts/r/innobase_drop_fts_index_table.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innobase_drop_fts_index_table.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,6 @@
+CREATE TABLE t (a INT, b TEXT);
+SET DEBUG='+d,alter_table_rollback_new_index';
+ALTER TABLE t ADD FULLTEXT INDEX (b(64));
+ERROR HY000: Unknown error
+SET DEBUG='-d,alter_table_rollback_new_index';
+DROP TABLE t;

=== added file 'mysql-test/suite/innodb_fts/r/innodb-fts-basic.result'
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-basic.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,238 @@
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('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 articles;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+SELECT * FROM articles
+WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT COUNT(IF(MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+AS count FROM articles;
+count
+2
+SELECT id,  body, MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
+FROM articles;
+id	body	score
+1	DBMS stands for DataBase ...	0.22764469683170319
+2	After you went through a ...	0
+3	In this tutorial we will show ...	0
+4	1. Never run mysqld as root. 2. ...	0
+5	In the following database comparison ...	0.22764469683170319
+6	When configured properly, MySQL ...	0
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('t*' IN BOOLEAN MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('MY*' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('ru*' IN BOOLEAN MODE);
+id	title	body
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
+id	title	body
+2	How To Use MySQL Well	After you went through a ...
+6	MySQL Security	When configured properly, MySQL ...
+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 ...
+1	MySQL Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+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 ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
+id	title	body
+2	How To Use MySQL Well	After you went through a ...
+1	MySQL Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+2	How To Use MySQL Well	After you went through a ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+6
+INSERT INTO articles (title,body) VALUES
+('test query expansion','for database ...');
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('test' WITH QUERY EXPANSION);
+id	title	body
+7	test query expansion	for database ...
+1	MySQL Tutorial	DBMS stands for DataBase ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following database"' IN BOOLEAN MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+INSERT INTO articles (title,body) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO articles (title,body) VALUES
+('test my proximity fts new search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO articles (title,body) VALUES
+('test more of proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+id	title	body
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+9	test my proximity fts new search, test, proximity and phrase	search, with proximity innodb
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id	title	body
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
+id	title	body
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+9	test my proximity fts new search, test, proximity and phrase	search, with proximity innodb
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+id	title	body
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+9	test my proximity fts new search, test, proximity and phrase	search, with proximity innodb
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+id	title	body
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+9	test my proximity fts new search, test, proximity and phrase	search, with proximity innodb
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+id	title	body
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+9	test my proximity fts new search, test, proximity and phrase	search, with proximity innodb
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+id	title	body
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id	title	body
+10	test more of proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+id	title	body
+drop table articles;

=== added file 'mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result'
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,229 @@
+CREATE TABLE fts_test (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+INSERT INTO fts_test (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM fts_test WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP INDEX idx ON fts_test;
+INSERT INTO fts_test (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+SELECT * FROM fts_test WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+7	MySQL Tutorial	DBMS stands for DataBase ...
+9	Optimizing MySQL	In this tutorial we will show ...
+SELECT * FROM fts_test WHERE MATCH (title,body)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+12	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+7	MySQL Tutorial	DBMS stands for DataBase ...
+8	How To Use MySQL Well	After you went through a ...
+9	Optimizing MySQL	In this tutorial we will show ...
+10	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+TRUNCATE TABLE fts_test;
+DROP INDEX idx ON fts_test;
+INSERT INTO fts_test (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+SELECT * FROM fts_test WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP TABLE fts_test;
+CREATE TABLE fts_test (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+create unique index FTS_DOC_ID_INDEX on fts_test(FTS_DOC_ID);
+INSERT INTO fts_test (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED.
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
+ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED.
+ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
+SELECT * FROM fts_test WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+drop index idx on fts_test;
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+SELECT * FROM fts_test WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+drop index idx on fts_test;
+drop index FTS_DOC_ID_INDEX on fts_test;
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+SELECT * FROM fts_test WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+drop table fts_test;
+CREATE TABLE fts_test (
+FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+title varchar(255) NOT NULL DEFAULT '',
+text mediumtext NOT NULL,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+set @@auto_increment_increment=10;
+INSERT INTO fts_test (title, text) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('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 fts_test;
+set @@auto_increment_increment=1;
+select *, match(title, text)  AGAINST ('database') as score
+from fts_test order by score desc;
+FTS_DOC_ID	title	text	score
+11	MySQL Tutorial	DBMS stands for DataBase ...	0.22764469683170319
+51	MySQL vs. YourSQL	In the following database comparison ...	0.22764469683170319
+21	How To Use MySQL Well	After you went through a ...	0
+31	Optimizing MySQL	In this tutorial we will show ...	0
+41	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...	0
+61	MySQL Security	When configured properly, MySQL ...	0
+drop index idx on fts_test;
+drop table fts_test;
+CREATE TABLE fts_test (
+FTS_DOC_ID int(20) unsigned NOT NULL AUTO_INCREMENT,
+title varchar(255) NOT NULL DEFAULT '',
+text mediumtext NOT NULL,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+ERROR 42000: Incorrect column name 'FTS_DOC_ID'
+CREATE TABLE fts_test (
+FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+title varchar(255) NOT NULL DEFAULT '',
+text mediumtext NOT NULL,
+PRIMARY KEY (FTS_DOC_ID),
+KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index
+CREATE TABLE articles (
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL ,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
+(9, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+(10, 'How To Use MySQL Well','After you went through a ...'),
+(12, 'Optimizing MySQL','In this tutorial we will show ...'),
+(14,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(19, 'MySQL vs. YourSQL','In the following database comparison ...'),
+(20, 'MySQL Security','When configured properly, MySQL ...');
+ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title),
+ADD FULLTEXT INDEX idx5 (title);
+ERROR HY000: InnoDB presently supports one FULLTEXT index creation at a time
+CREATE FULLTEXT INDEX idx on articles (title);
+ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title);
+ALTER TABLE articles ADD INDEX t20 (title(20)), LOCK=NONE;
+ALTER TABLE articles DROP INDEX t20;
+INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
+(29, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+(30, 'How To Use MySQL Well','After you went through a ...'),
+(32, 'Optimizing MySQL','In this tutorial we will show ...'),
+(34,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(39, 'MySQL vs. YourSQL','In the following database comparison ...'),
+(40, 'MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH (title)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+9	MySQL Tutorial	DBMS stands for DataBase ...
+29	MySQL Tutorial	DBMS stands for DataBase ...
+DROP INDEX idx ON articles;
+SELECT * FROM articles WHERE MATCH (title)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+9	MySQL Tutorial	DBMS stands for DataBase ...
+29	MySQL Tutorial	DBMS stands for DataBase ...
+CREATE FULLTEXT INDEX idx on articles (title, body);
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+9	MySQL Tutorial	DBMS stands for DataBase ...
+12	Optimizing MySQL	In this tutorial we will show ...
+29	MySQL Tutorial	DBMS stands for DataBase ...
+32	Optimizing MySQL	In this tutorial we will show ...
+DROP TABLE articles;
+create table articles(`FTS_DOC_ID` serial,
+`col32` timestamp not null,`col115` text) engine=innodb;
+create fulltext index `idx5` on articles(`col115`)  ;
+alter ignore table articles add primary key  (`col32`)  ;
+drop table articles;
+CREATE TABLE articles (
+id INT UNSIGNED NOT NULL,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+INSERT INTO articles VALUES
+(1, 'MySQL Tutorial','DBMS stands for 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','1. Never run mysqld as root. 2. ...'),
+(5, 'MySQL vs. YourSQL','In the following database comparison ...'),
+(6, 'MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on articles (title, body);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+DROP INDEX idx ON articles;
+CREATE UNIQUE INDEX idx2 ON articles(id);
+CREATE FULLTEXT INDEX idx on articles (title, body);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP TABLE articles;

=== added file 'mysql-test/suite/innodb_fts/r/innodb-fts-fic.result'
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,190 @@
+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 DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on articles (title, body);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title, body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+SELECT * FROM articles
+WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT COUNT(IF(MATCH (title, body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+AS count FROM articles;
+count
+2
+ANALYZE TABLE articles;
+Table	Op	Msg_type	Msg_text
+test.articles	analyze	status	OK
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+DROP INDEX idx ON articles;
+CREATE FULLTEXT INDEX idx on articles (title, body);
+CREATE FULLTEXT INDEX idx1 on articles (title);
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP INDEX idx ON articles;
+DROP INDEX idx1 ON articles;
+CREATE FULLTEXT INDEX idx1 on articles (title);
+SELECT * FROM articles WHERE MATCH (title)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+drop table articles;
+CREATE TABLE articles (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+create unique index FTS_DOC_ID_INDEX on articles(FTS_DOC_ID);
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on articles (title, body);
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+drop table articles;
+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 DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on articles (title);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+CREATE FULLTEXT INDEX idx2 on articles (body);
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+ERROR HY000: Can't find FULLTEXT index matching the column list
+SELECT * FROM articles WHERE MATCH (title)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+3	Optimizing MySQL	In this tutorial we will show ...
+drop index idx2 on articles;
+SELECT * FROM articles WHERE MATCH (body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+ERROR HY000: Can't find FULLTEXT index matching the column list
+CREATE FULLTEXT INDEX idx2 on articles (body);
+SELECT * FROM articles WHERE MATCH (body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+3	Optimizing MySQL	In this tutorial we will show ...
+UPDATE articles set title = 'aaaa'
+WHERE MATCH(title) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+SELECT * FROM articles WHERE MATCH (title)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title)
+AGAINST ('aaaa' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	aaaa	DBMS stands for DataBase ...
+drop table articles;
+CREATE TABLE articles (
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL ,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+CREATE FULLTEXT INDEX idx on articles (title);
+INSERT INTO articles  VALUES (9, 'MySQL Tutorial','DBMS stands for DataBase ...');
+UPDATE articles set title = 'bbbb'  WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+ERROR HY000: Invalid InnoDB FTS Doc ID
+UPDATE articles set title = 'bbbb', FTS_DOC_ID=8  WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+ERROR HY000: Invalid InnoDB FTS Doc ID
+UPDATE articles set title = 'bbbb', FTS_DOC_ID=10  WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+SELECT * FROM articles WHERE MATCH (title) AGAINST ('bbbb' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+10	bbbb	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+CREATE FULLTEXT INDEX idx2 ON articles (body);
+SELECT * FROM articles WHERE MATCH (body) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID	title	body
+10	bbbb	DBMS stands for DataBase ...
+UPDATE articles set body = 'bbbb', FTS_DOC_ID=11  WHERE MATCH(body) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+drop table articles;
+create table `articles`(`a` varchar(2) not null)engine=innodb;
+create fulltext index `FTS_DOC_ID_INDEX` on `articles`(`a`);
+ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index
+create unique index `a` on `articles`(`a`);
+drop table articles;
+CREATE TABLE wp(
+FTS_DOC_ID bigint PRIMARY KEY,
+title VARCHAR(255) NOT NULL DEFAULT '',
+text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB;
+INSERT INTO wp (FTS_DOC_ID, title, text) VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+(2, 'How To Use MySQL Well','After you went through a ...');
+CREATE FULLTEXT INDEX idx ON wp(title, text);
+ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index
+DROP TABLE wp;
+CREATE TABLE wp(
+FTS_DOC_ID bigint unsigned PRIMARY KEY,
+title VARCHAR(255) NOT NULL DEFAULT '',
+text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB;
+INSERT INTO wp (FTS_DOC_ID, title, text) VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+(2, 'How To Use MySQL Well','After you went through a ...');
+CREATE FULLTEXT INDEX idx ON wp(title, text);
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database')
+FROM wp;
+FTS_DOC_ID	MATCH(title, text) AGAINST ('database')
+1	0.0906190574169159
+2	0
+DROP TABLE wp;

=== added file 'mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result'
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,754 @@
+select * from information_schema.innodb_ft_default_stopword;
+value
+a
+about
+an
+are
+as
+at
+be
+by
+com
+de
+en
+for
+from
+how
+i
+in
+is
+it
+la
+of
+on
+or
+that
+the
+this
+to
+was
+what
+when
+where
+who
+will
+with
+und
+the
+www
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id	title	body
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+set global innodb_ft_server_stopword_table = "not_defined";
+ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
+create table user_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+drop index title on articles;
+create fulltext index idx on articles(title, body);
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id	title	body
+5	MySQL vs. YourSQL	In the following database comparison ...
+CREATE TABLE articles_2 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_2 (title, body)
+VALUES ('test for stopwords','this is it...');
+SELECT * FROM articles_2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	test for stopwords	this is it...
+insert into user_stopword values("this");
+CREATE TABLE articles_3 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_3 (title, body)
+VALUES ('test for stopwords','this is it...');
+SELECT * FROM articles_3 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id	title	body
+create table user_stopword_session(value varchar(30)) engine = innodb;
+insert into user_stopword_session values("session");
+set session innodb_ft_user_stopword_table="test/user_stopword_session";
+CREATE TABLE articles_4 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_4 (title, body)
+VALUES ('test for session stopwords','this should also be excluded...');
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+AGAINST ('session' IN NATURAL LANGUAGE MODE);
+id	title	body
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	test for session stopwords	this should also be excluded...
+CREATE TABLE articles_5 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_5 (title, body)
+VALUES ('test for session stopwords','this should also be excluded...');
+SELECT * FROM articles_5 WHERE MATCH (title,body)
+AGAINST ('session' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	test for session stopwords	this should also be excluded...
+drop table articles;
+drop table articles_2;
+drop table articles_3;
+drop table articles_4;
+drop table articles_5;
+drop table user_stopword;
+drop table user_stopword_session;
+SET GLOBAL innodb_ft_enable_stopword=1;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table	Create Table
+articles	CREATE TABLE `articles` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(200) DEFAULT NULL,
+  `body` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	title	body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id	title	body
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 7;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+DELETE FROM articles WHERE  MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 7;
+id	title	body
+7	update the record	to see will is indexed or not
+DELETE FROM articles WHERE id = 7;
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	title	body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id	title	body
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' 
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' 
+WHERE id = 8;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+SELECT * FROM articles WHERE id = 8;
+id	title	body
+8	update the record	to see will is indexed or not
+DELETE FROM articles WHERE  MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 8;
+id	title	body
+8	update the record	to see will is indexed or not
+DELETE FROM articles WHERE id = 8;
+ALTER TABLE articles DROP INDEX idx;
+SHOW CREATE TABLE articles;
+Table	Create Table
+articles	CREATE TABLE `articles` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(200) DEFAULT NULL,
+  `body` text,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+ANALYZE TABLE articles;
+Table	Op	Msg_type	Msg_text
+test.articles	analyze	status	OK
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id	title	body
+2	when To Use MySQL Well	After that you went through a ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+6	MySQL Security	When configured properly, MySQL ...
+2	when To Use MySQL Well	After that you went through a ...
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id	title	body
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	In what tutorial we will show ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id	title	body
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+9	the record will	not index the , will words
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id	title	body
+9	the record will	not index the , will words
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT COUNT(*),max(id) FROM articles;
+COUNT(*)	max(id)
+7	9
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+9	update the record	to see will is indexed or not
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+9	update the record	to see will is indexed or not
+DELETE FROM articles WHERE  MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 9;
+id	title	body
+DROP TABLE articles;
+SET SESSION innodb_ft_enable_stopword=1;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+create table server_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+insert into server_stopword values("what"),("where");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+DELETE FROM user_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+SET SESSION innodb_ft_enable_stopword = 0;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SET SESSION innodb_ft_enable_stopword = 1;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table = default;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+DROP TABLE articles,user_stopword,server_stopword;
+SET SESSION innodb_ft_enable_stopword=1;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table	Create Table
+articles	CREATE TABLE `articles` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(200) DEFAULT NULL,
+  `body` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("mysqld"),("DBMS");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id	title	body
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id	title	body
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id	title	body
+set session innodb_ft_user_stopword_table = default;
+create table server_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into server_stopword values("root"),("properly");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id	title	body
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id	title	body
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+DELETE FROM user_stopword;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+DELETE FROM server_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id	title	body
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id	title	body
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id	title	body
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+DROP TABLE articles,user_stopword,server_stopword;
+SET SESSION innodb_ft_enable_stopword=1;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table	Create Table
+articles	CREATE TABLE `articles` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `title` varchar(200) DEFAULT NULL,
+  `body` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+"In connection 1"
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+ANALYZE TABLE articles;
+Table	Op	Msg_type	Msg_text
+test.articles	analyze	status	OK
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id	title	body
+2	when To Use MySQL Well	After that you went through a ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+6	MySQL Security	When configured properly, MySQL ...
+2	when To Use MySQL Well	After that you went through a ...
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id	title	body
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	In what tutorial we will show ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id	title	body
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SET SESSION innodb_ft_enable_stopword = 1;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	title	body
+"In connection default"
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	title	body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id	title	body
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id	title	body
+"In connection 1"
+SET SESSION innodb_ft_enable_stopword = 1;
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+"In connection default"
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id	title	body
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+create table user_stopword_1(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+insert into user_stopword_1 values("when");
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id	title	body
+2	when To Use MySQL Well	After that you went through a ...
+6	MySQL Security	When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+id	title	body
+2	when To Use MySQL Well	After that you went through a ...
+6	MySQL Security	When configured properly, MySQL ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+id	title	body
+"In connection 1"
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+create table server_stopword(value varchar(30)) engine = innodb;
+SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/server_stopword
+insert into server_stopword values("when"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+id	title	body
+"In connection default"
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/server_stopword
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+insert into server_stopword values("where"),("will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id	title	body
+3	where will Optimizing MySQL	In what tutorial we will show ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+id	title	body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id	title	body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id	title	body
+DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
+SET SESSION innodb_ft_enable_stopword=1;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,305 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+a TEXT,
+b TEXT
+) ENGINE = InnoDB;
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID);
+"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data1.txt"
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+49
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+AGAINST ('row35col2word49' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID
+35
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row5col2word49" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row35col2word49 +(row35col1word49 row35col2word40)" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row35col2word49 -(row45col2word49)" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("row5col2word49 row5col2word40" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH a,b AGAINST ("+row5col2word* +row5col1word49*" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH a,b AGAINST ('"row35col2word49"' IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH a,b AGAINST ('"ROW35col2WORD49"' IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST ("row5col2word49" WITH QUERY EXPANSION);
+COUNT(*)
+1
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"row5col2word48 row5col2word49"@2' IN BOOLEAN MODE);
+FTS_DOC_ID
+5
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"row5col2word48 row5col2word49"@1' IN BOOLEAN MODE);
+FTS_DOC_ID	a	b
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", FTS_DOC_ID = FTS_DOC_ID + 10000
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+a	b
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+a	b
+using update	changing fulltext index record
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+a	b
+using update	changing fulltext index record
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+a	b
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+a TEXT,
+b TEXT
+) ENGINE = InnoDB;
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID);
+"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data2.txt"
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+100
+SELECT FTS_DOC_ID from t1 WHERE b like '%row300col2word30%';
+FTS_DOC_ID
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+AGAINST ('row35col2word49' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID
+35
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row5col2word49" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row35col2word49 +(row35col1word49 row35col2word40)" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row35col2word49 -(row45col2word49)" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("row5col2word49 row5col2word40" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ("+row5col2word* +row5col1word49*" IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ('"row35col2word49"' IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ('"ROW35col2WORD49"' IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST ("row5col2word49" WITH QUERY EXPANSION);
+COUNT(*)
+1
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"row5col2word48 row5col2word49"@2' IN BOOLEAN MODE);
+FTS_DOC_ID
+5
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"row5col2word48 row5col2word49"@1' IN BOOLEAN MODE);
+FTS_DOC_ID	a	b
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", FTS_DOC_ID = FTS_DOC_ID + 10000
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+SELECT a,b FROM t1
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+a	b
+SELECT a,b FROM t1
+WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+a	b
+using update	changing fulltext index record
+SELECT a,b FROM t1
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+a	b
+using update	changing fulltext index record
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+a	b
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+UPDATE t1 SET a = NULL , b = NULL, FTS_DOC_ID= 6000 + FTS_DOC_ID;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+COUNT(*)
+99
+ALTER TABLE t1 DROP INDEX idx;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+COUNT(*)
+99
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+a TEXT,
+b TEXT
+) ENGINE = InnoDB;
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID);
+"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data3.txt"
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+100
+SELECT COUNT(*) from t1 WHERE b like '%samerowword%';
+COUNT(*)
+100
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b)
+AGAINST ('samerowword' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword -(row45col2word49)" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ("+sameroww" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST ("samerowword" WITH QUERY EXPANSION);
+COUNT(*)
+100
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", 
+FTS_DOC_ID = FTS_DOC_ID + 10000 
+WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+COUNT(*)
+100
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+COUNT(*)
+0
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+UPDATE t1 SET a = NULL , b = NULL ;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+COUNT(*)
+0
+ALTER TABLE t1 DROP INDEX idx;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+COUNT(*)
+0
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+a TEXT,
+b TEXT
+) ENGINE = InnoDB;
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID);
+"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data4.txt"
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+100
+SELECT COUNT(*) from t1 WHERE a like '%samerowword%';
+COUNT(*)
+100
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b)
+AGAINST ('samerowword' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword -(1050)" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 WHERE MATCH a,b AGAINST ("+2001" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST ("samerowword" WITH QUERY EXPANSION);
+COUNT(*)
+100
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", 
+FTS_DOC_ID = FTS_DOC_ID + 10000 
+WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+COUNT(*)
+0
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+COUNT(*)
+100
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+COUNT(*)
+100
+DELETE FROM t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+COUNT(*)
+0
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+UPDATE t1 SET a = NULL , b = NULL ;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+COUNT(*)
+0
+ALTER TABLE t1 DROP INDEX idx;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+COUNT(*)
+0
+DROP TABLE t1;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_misc.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,1239 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `a` varchar(200) DEFAULT NULL,
+  `b` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+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 ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+id
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+id
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+INSERT INTO t1 (a,b) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id
+8
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+id
+8
+9
+10
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+id
+8
+9
+10
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id
+10
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE);
+id
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+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 ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+SELECT id FROM t1 WHERE id = (SELECT MAX(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+id
+3
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+id
+1
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+id
+1
+3
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+) OR t1.id = 3 ;
+id
+1
+3
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 
+WHERE MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) 
+AND t2.id != 3) ;
+id
+1
+SELECT id FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE 
+MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+id
+1
+3
+SELECT id FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1 
+WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ;
+id
+2
+3
+4
+5
+6
+SELECT id FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) 
+AND t1.id = t2.id) ;
+id
+1
+3
+SELECT id FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) 
+AND t1.id = t2.id) ;
+id
+2
+4
+5
+6
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT ,
+FULLTEXT (a,b)
+) ENGINE = InnoDB;
+INSERT INTO t1(a,b) VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE 
+MATCH(t2.a,t2.b) AGAINST("+support +collections" IN BOOLEAN MODE));
+id
+3
+SELECT id FROM t1 WHERE t1.id != (SELECT MIN(t2.id) FROM t1 AS t2 WHERE 
+MATCH(t2.a,t2.b) AGAINST("+search" IN BOOLEAN MODE));
+id
+2
+3
+4
+5
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ("+call* +coll*" IN BOOLEAN MODE));
+id
+2
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE 
+MATCH t2.a,t2.b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE) AND t2.id=t1.id);
+id
+1
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+INSERT INTO t1 (a,b) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+id
+7
+SELECT id FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+id
+8
+9
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+id
+7
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"proximity search"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+id
+7
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@3' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+id
+9
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+id
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('support') ;
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `id` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT id FROM t2;
+id
+1
+3
+DROP TABLE t2;
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST("+support +collections" IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `id` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT id FROM t2;
+id
+3
+DROP TABLE t2;
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('"proximity search"@10' IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `id` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT id FROM t2;
+id
+7
+8
+9
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...');
+INSERT INTO t1 (a,b) VALUES
+('when To Use MySQL Well','After that you went through a ...');
+INSERT INTO t1 (a,b) VALUES
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+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 null...');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+106
+SELECT COUNT(*) FROM t1 WHERE a IS NULL;
+COUNT(*)
+100
+SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL;
+COUNT(*)
+6
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+103
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST (NULL IN NATURAL LANGUAGE MODE);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST (NULL WITH QUERY EXPANSION);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('null' IN NATURAL LANGUAGE MODE);
+id
+106
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id
+106
+1
+52
+103
+104
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NOT NULL OR b IS NOT NULL);
+id
+106
+1
+52
+103
+104
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NULL AND b IS NOT NULL);
+id
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id
+1
+106
+SELECT COUNT(*) FROM t1
+WHERE MATCH (a,b)
+AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+6
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"following database"@10' IN BOOLEAN MODE);
+id
+105
+DROP TABLE t1;
+drop table if exists t50;
+set names utf8;
+"----------Test1---------"
+create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb;
+create fulltext index i on t50 (s1);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+insert into t50 values ('ABCDE'),('FGHIJ'),('KLMNO'),('V����W��');
+select * from t50 where match(s1) against ('V����W��');
+s1
+V����W��
+drop table t50;
+"----------Test2---------"
+create table t50 (s1 int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('V����W��'),('ABCDE');
+select * from t50 order by s2;
+s1	s2
+4	ABCDE
+1	FGHIJ
+2	KLMNO
+3	V����W��
+drop table t50;
+"----------Test3---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('V����W��'),('ABCDE');
+set @@autocommit=0;
+update t50 set s2 = lower(s2);
+update t50 set s2 = upper(s2);
+commit;
+select * from t50 where match(s2) against ('V����W�� FGHIJ KLMNO ABCDE' in boolean mode);
+id	s2
+1	FGHIJ
+2	KLMNO
+3	V����WI
+4	ABCDE
+select * from t50;
+id	s2
+1	FGHIJ
+2	KLMNO
+3	V����WI
+4	ABCDE
+drop table t50;
+set @@autocommit=1;
+"----------Test4---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('V����W��'),('ABCD*');
+select * from t50 where match(s2) against ('abcd*' in natural language
+mode);
+id	s2
+select * from t50 where match(s2) against ('abcd*' in boolean mode);
+id	s2
+4	ABCD*
+drop table t50;
+"----------Test5---------"
+create table t50 (s1 int, s2 varchar(200), fulltext key(s2)) engine = innodb;
+set @@autocommit=0;
+insert into t50 values (1,'Sunshine'),(2,'Lollipops');
+select * from t50 where match(s2) against('Rainbows');
+s1	s2
+rollback;
+select * from t50;
+s1	s2
+drop table t50;
+set @@autocommit=1;
+"----------Test6---------"
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('aab` MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('aas How To Use MySQL Well','After you went through a ...'),
+('aac Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t1 (a,b) VALUES
+('aac 1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('aab MySQL vs. YourSQL','In the following database comparison ...'),
+('aaa MySQL Security','When configured properly, MySQL ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aac') DESC;
+id	a	b
+3	aac Optimizing MySQL	In this tutorial we will show ...
+4	aac 1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+1	aab` MySQL Tutorial	DBMS stands for DataBase ...
+2	aas How To Use MySQL Well	After you went through a ...
+5	aab MySQL vs. YourSQL	In the following database comparison ...
+6	aaa MySQL Security	When configured properly, MySQL ...
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aab') DESC;
+id	a	b
+1	aab` MySQL Tutorial	DBMS stands for DataBase ...
+5	aab MySQL vs. YourSQL	In the following database comparison ...
+2	aas How To Use MySQL Well	After you went through a ...
+3	aac Optimizing MySQL	In this tutorial we will show ...
+4	aac 1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+6	aaa MySQL Security	When configured properly, MySQL ...
+"----------Test7---------"
+select * from t1 where match(a,b) against ('aaa')
+union select * from t1 where match(a,b) against ('aab')
+union select * from t1 where match(a,b) against ('aac');
+id	a	b
+6	aaa MySQL Security	When configured properly, MySQL ...
+1	aab` MySQL Tutorial	DBMS stands for DataBase ...
+5	aab MySQL vs. YourSQL	In the following database comparison ...
+3	aac Optimizing MySQL	In this tutorial we will show ...
+4	aac 1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+select * from t1 where match(a,b) against ('aaa')
+or    match(a,b) against ('aab')
+or    match(a,b) against ('aac');
+id	a	b
+1	aab` MySQL Tutorial	DBMS stands for DataBase ...
+3	aac Optimizing MySQL	In this tutorial we will show ...
+4	aac 1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+5	aab MySQL vs. YourSQL	In the following database comparison ...
+6	aaa MySQL Security	When configured properly, MySQL ...
+DROP TABLE t1;
+"----------Test8---------"
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ... abcd')  ,
+('How To Use MySQL Well','After you went through a q ...abdd'),
+('Optimizing MySQL','In this tutorial we will show ...abed');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `a` varchar(200) DEFAULT NULL,
+  `b` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. q ...'),
+('MySQL vs. YourSQL use','In the following database comparison ...'),
+('MySQL Security','When run configured properly, MySQL ...');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+id	a	b
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. q ...
+6	MySQL Security	When run configured properly, MySQL ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use');
+id	a	b
+2	How To Use MySQL Well	After you went through a q ...abdd
+5	MySQL vs. YourSQL use	In the following database comparison ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went');
+id	a	b
+2	How To Use MySQL Well	After you went through a q ...abdd
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run') AND NOT MATCH(a,b) AGAINST ('q');
+id	a	b
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. q ...
+6	MySQL Security	When run configured properly, MySQL ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use') AND NOT MATCH(a,b) AGAINST ('q');
+id	a	b
+2	How To Use MySQL Well	After you went through a q ...abdd
+5	MySQL vs. YourSQL use	In the following database comparison ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went') AND NOT MATCH(a,b) AGAINST ('q');
+id	a	b
+2	How To Use MySQL Well	After you went through a q ...abdd
+"----------Test9---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SET @x = (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+SELECT @x, @x2;
+ at x	@x2
+7	0
+DROP TABLE t2;
+"----------Test10---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t2;
+"----------Test11---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE = MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+ALTER TABLE t2 ENGINE=InnoDB;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+id	a	b
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. q ...
+6	MySQL Security	When run configured properly, MySQL ...
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t2,t1;
+"----------Test13---------"
+set names utf8;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_SPANISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 VALUES (1,'aaCen'),(2,'aaCha'),(3,'aaCio'),(4,'aa��en'),(5,'aa��ha'),(6,'aa��io');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aach*' IN BOOLEAN MODE);
+s1	s2
+2	aaCha
+5	aa��ha
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aaC*' IN BOOLEAN MODE);
+s1	s2
+1	aaCen
+2	aaCha
+3	aaCio
+4	aa��en
+5	aa��ha
+6	aa��io
+DROP TABLE t1;
+"----------Test14---------"
+CREATE TABLE t1(s1 INT , s2 VARCHAR(100) CHARACTER SET sjis) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 VALUES (1,'���������'),(2,'���������'),(3,'���������'),(4,'���������');
+DROP TABLE t1;
+"----------Test15---------"
+CREATE TABLE t1 (s1 VARCHAR (60) CHARACTER SET UTF8 COLLATE UTF8_UNICODE_520_CI) ENGINE = MyISAM;
+CREATE FULLTEXT INDEX i ON t1 (s1);
+INSERT INTO t1 VALUES
+('a'),('b'),('c'),('d'),('��������'),('LLLL'),(NULL),('�������� ��������'),('LLLLLLLL');
+SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+s1
+��������
+LLLL
+�������� ��������
+DROP TABLE if EXISTS t2;
+Warnings:
+Note	1051	Unknown table 'test.t2'
+CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t2 ( s1);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t2 VALUES
+('a'),('b'),('c'),('d'),('��������'),('LLLL'),(NULL),('�������� ��������'),('LLLLLLLL');
+SELECT * FROM t2 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+s1
+LLLL
+DROP TABLE t1,t2;
+"----------Test16---------"
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(50) CHARACTER SET UTF8) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1(s2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 VALUES (2, '���� Da��i      p          ');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('+p +"���� Da��i*"' IN BOOLEAN MODE);
+s1	s2
+DROP TABLE t1;
+"----------Test19---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'��������');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('"��������"' IN BOOLEAN MODE);
+id	char_column
+1	��������
+DROP TABLE t1;
+"----------Test20---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_column2 VARCHAR(60) character set utf8) ENGINE = InnoDB;
+INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu');
+UPDATE t1 SET char_column2 = char_column;
+CREATE FULLTEXT INDEX i ON t1 (char_column2);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
+id	char_column	char_column2
+NULL	abcde	abcde
+DROP TABLE t1;
+"----------Test22---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'aaa'),(2,'bbb'),(3,'ccc');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+HANDLER t1 OPEN;
+HANDLER t1 READ i = ('aaa');
+id	char_column
+DROP TABLE t1;
+"----------Test25---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_CROATIAN_CI) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'��in'),(2,'ljin'),(3,'lmin'),(4,'����������');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT count(*) FROM t1 WHERE MATCH (char_column) AGAINST ('lj*' IN BOOLEAN MODE);
+count(*)
+3
+DROP TABLE t1;
+"----------Test27---------"
+CREATE TABLE t1 (id INT,char_column VARCHAR(60));
+SET @@autocommit=0;
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+INSERT INTO t1 values (1,'aaa');
+"restart server..."
+# Restart the server
+--source include/restart_mysqld.inc
+DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb')
+SET @@autocommit=1;
+DROP TABLE t1;
+"----------Test28---------"
+drop table if exists `fts_test`;
+Warnings:
+Note	1051	Unknown table 'test.fts_test'
+create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
+set session autocommit=0;
+insert into `fts_test` values ('');
+savepoint `b`;
+savepoint `b`;
+set session autocommit=1;
+DROP TABLE fts_test;
+"----------Test29---------"
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+start transaction;
+INSERT INTO articles (title,body) VALUES 
+('How To Use MySQL Well','After you went through a ...');
+savepoint `a1`;
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+savepoint `a2`;
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+savepoint `a3`;
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+savepoint `a4`;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+rollback to savepoint a3;
+select title, body from articles;
+title	body
+MySQL Tutorial	DBMS stands for DataBase ...
+How To Use MySQL Well	After you went through a ...
+Optimizing MySQL	In this tutorial we will show ...
+1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+savepoint `a5`;
+select title, body from articles;
+title	body
+MySQL Tutorial	DBMS stands for DataBase ...
+How To Use MySQL Well	After you went through a ...
+Optimizing MySQL	In this tutorial we will show ...
+1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+MySQL Security	When configured properly, MySQL ...
+rollback to savepoint a2;
+select title, body from articles;
+title	body
+MySQL Tutorial	DBMS stands for DataBase ...
+How To Use MySQL Well	After you went through a ...
+Optimizing MySQL	In this tutorial we will show ...
+commit;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP TABLE articles;
+"----------Test30---------"
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+start transaction;
+INSERT INTO articles (title,body) VALUES 
+('How To Use MySQL Well','After you went through a ...');
+savepoint `a1`;
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+savepoint `a2`;
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+savepoint `a3`;
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+savepoint `a4`;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+rollback to savepoint a3;
+select title, body from articles;
+title	body
+MySQL Tutorial	DBMS stands for DataBase ...
+How To Use MySQL Well	After you went through a ...
+Optimizing MySQL	In this tutorial we will show ...
+1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+savepoint `a5`;
+select title, body from articles;
+title	body
+MySQL Tutorial	DBMS stands for DataBase ...
+How To Use MySQL Well	After you went through a ...
+Optimizing MySQL	In this tutorial we will show ...
+1001 MySQL Tricks	1. Never run mysqld as root. 2. ...
+MySQL Security	When configured properly, MySQL ...
+rollback to savepoint a2;
+select title, body from articles;
+title	body
+MySQL Tutorial	DBMS stands for DataBase ...
+How To Use MySQL Well	After you went through a ...
+Optimizing MySQL	In this tutorial we will show ...
+rollback;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+DROP TABLE articles;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('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 articles;
+SELECT *,  MATCH(title, body) AGAINST ('-database +MySQL' IN BOOLEAN MODE) AS score from articles;
+id	title	body	score
+1	MySQL Tutorial	DBMS stands for DataBase ...	0
+2	How To Use MySQL Well	After you went through a ...	0.000000001885928302414186
+3	Optimizing MySQL	In this tutorial we will show ...	0.000000001885928302414186
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...	0.000000001885928302414186
+5	MySQL vs. YourSQL	In the following database comparison ...	0
+6	MySQL Security	When configured properly, MySQL ...	0.000000003771856604828372
+SELECT *, MATCH(title, body) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score  FROM articles;
+id	title	body	score
+1	MySQL Tutorial	DBMS stands for DataBase ...	0
+2	How To Use MySQL Well	After you went through a ...	0.000000001885928302414186
+3	Optimizing MySQL	In this tutorial we will show ...	0.000000001885928302414186
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...	0.000000001885928302414186
+5	MySQL vs. YourSQL	In the following database comparison ...	0
+6	MySQL Security	When configured properly, MySQL ...	0.000000003771856604828372
+SELECT * FROM articles where  MATCH(title, body) AGAINST ('MySQL - (database - tutorial)' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database)' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for 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	1. Never run mysqld as root. 2. ...
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database) -Tricks' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for DataBase ...
+2	How To Use MySQL Well	After you went through a ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT * FROM articles where MATCH(title, body) AGAINST ('-Tricks MySQL - (- tutorial database)' IN BOOLEAN MODE);
+id	title	body
+6	MySQL Security	When configured properly, MySQL ...
+1	MySQL Tutorial	DBMS stands for DataBase ...
+2	How To Use MySQL Well	After you went through a ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP TABLE articles;
+drop table if exists t1;
+Warnings:
+Note	1051	Unknown table 'test.t1'
+create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key,
+title varchar(200),body text,fulltext(title,body)) engine=innodb;
+insert into t1 set body='test';
+select * from t1 where match(title,body) against('%test');
+FTS_DOC_ID	title	body
+1	NULL	test
+select * from t1 where match(title,body) against('%');
+FTS_DOC_ID	title	body
+select * from t1 where match(title,body) against('%%%%');
+FTS_DOC_ID	title	body
+drop table t1;
+CREATE DATABASE `benu database`;
+USE `benu database`;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `a` varchar(200) DEFAULT NULL,
+  `b` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+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 ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+DROP DATABASE `benu database`;
+USE test;
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`), fulltext key (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+Warnings:
+Note	1831	Duplicate index 'a_2' defined on the table 'test.t21'. This is deprecated and will be disallowed in a future release.
+ALTER  TABLE `t21` ADD UNIQUE INDEX (`b`), ALGORITHM=INPLACE;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
+ALTER  TABLE `t21` ADD UNIQUE INDEX (`b`);
+DROP TABLE t21;
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`)) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+ALTER  TABLE `t21` ADD UNIQUE INDEX (`b`);
+DROP TABLE t21;
+CREATE TABLE t1 (
+id INT NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+ALTER  TABLE t1 ADD UNIQUE INDEX (`id`);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER  TABLE t1 ADD UNIQUE INDEX (`id`), ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+ALTER  TABLE t1 ADD UNIQUE INDEX (`FTS_DOC_ID`);
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID
+1
+3
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+FTS_DOC_ID	x
+1	0
+2	0
+3	0
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b), ADD UNIQUE INDEX FTS_DOC_ID_INDEX (FTS_DOC_ID);
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID
+1
+3
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+FTS_DOC_ID	x
+1	0
+2	0
+3	0
+DROP TABLE t1;
+CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB
+DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO `t2` VALUES();
+COMMIT WORK AND CHAIN;
+INSERT  INTO `t3` VALUES ();
+UPDATE  `t2` SET `b` = 'a';
+SAVEPOINT BATCH1;
+DROP TABLE t2;
+DROP TABLE t3;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+COMMIT WORK AND CHAIN;
+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 ...');
+SAVEPOINT BATCH1;
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id
+1
+2
+3
+INSERT INTO t1 (a,b) VALUES
+('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+ROLLBACK TO SAVEPOINT BATCH1;
+COMMIT;
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id
+6
+1
+2
+3
+4
+5
+DROP TABLE t1;
+CREATE TABLE `t` (`a` char(20) character set utf8 default null,
+fulltext key (`a`)) ENGINE=INNODB;
+INSERT INTO `t` VALUES ('a');
+INSERT INTO `t` VALUES ('aaa');
+SELECT MATCH(`a`) AGAINST (0x22dd22) FROM `t`;
+MATCH(`a`) AGAINST (0x22dd22)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x2222) FROM `t`;
+MATCH(`a`) AGAINST (0x2222)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x22) FROM `t`;
+MATCH(`a`) AGAINST (0x22)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x2261616122) FROM `t`;
+MATCH(`a`) AGAINST (0x2261616122)
+0
+0.0906190574169159
+SELECT MATCH(`a`) AGAINST (0x2261dd6122) FROM `t`;
+MATCH(`a`) AGAINST (0x2261dd6122)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x2261dd612222226122) FROM `t`;
+MATCH(`a`) AGAINST (0x2261dd612222226122)
+0
+0
+DROP TABLE t;
+CREATE TABLE t(a CHAR(1),FULLTEXT KEY(a)) ENGINE=INNODB;
+HANDLER t OPEN;
+HANDLER t READ a NEXT;
+a
+HANDLER t READ a PREV;
+a
+DROP TABLE t;
+CREATE TABLE `%`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+CREATE TABLE `A B`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+DROP TABLE `%`;
+DROP TABLE `A B`;
+CREATE TABLE `t-26`(a VARCHAR(10),FULLTEXT KEY(a)) ENGINE=INNODB;
+INSERT INTO `t-26` VALUES('117');
+DROP TABLE `t-26`;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,908 @@
+drop table if exists t2,t1;
+set names utf8;
+CREATE TABLE t1 (
+id1 INT ,
+a1 VARCHAR(200) ,
+b1 TEXT ,
+FULLTEXT KEY (a1,b1), PRIMARY KEY (a1, id1)
+) CHARACTER SET = utf8 , ENGINE = InnoDB;
+CREATE TABLE t2 (
+id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a2 VARCHAR(200),
+b2 TEXT ,
+FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+FULLTEXT KEY (b2,a2)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(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 ...');
+INSERT INTO t1 (id1,a1,b1) VALUES
+(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 ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t2 (a2,b2) 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 ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+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') ;
+id1
+1
+3
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ;
+id2
+1
+3
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id1
+3
+6
+2
+4
+5
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id2
+3
+6
+2
+4
+5
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
+id1
+1
+3
+5
+6
+2
+4
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
+id2
+1
+3
+5
+6
+2
+4
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id1
+1
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id2
+1
+set global innodb_optimize_fulltext_only=1;
+optimize table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	status	OK
+set global innodb_optimize_fulltext_only=0;
+UPDATE t1 SET a1 = "changing column - on update cascade" , b1 = "to check foreign constraint" 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) ;
+id1
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id2
+6
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ;
+id1
+4
+2
+6
+5
+3
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ;
+id2
+4
+2
+6
+5
+3
+SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%';
+id2
+2
+3
+4
+5
+6
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on update cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on delete cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1  where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on delete set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1 where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on update set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+create table t1 (s1 bigint unsigned not null, s2 varchar(200),
+primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL, s2 varchar(200),
+foreign key (FTS_DOC_ID) references t1 (s1)
+on update cascade) ENGINE = InnoDB;
+create fulltext index idx on t2(s2);
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `FTS_DOC_ID` bigint(20) unsigned NOT NULL,
+  `s2` varchar(200) DEFAULT NULL,
+  KEY `FTS_DOC_ID` (`FTS_DOC_ID`),
+  FULLTEXT KEY `idx` (`s2`),
+  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s1 = 3 where s1=1;
+select * from t2 where match(s2) against ('sunshine');
+FTS_DOC_ID	s2
+3	Sunshine
+update t1 set s1 = 1 where s1=3;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (
+id1 INT ,
+a1 VARCHAR(200) PRIMARY KEY,
+b1 TEXT character set utf8 ,
+FULLTEXT KEY (a1,b1)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+CREATE TABLE t2 (
+id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a2 VARCHAR(200),
+b2 TEXT character set utf8 ,
+FOREIGN KEY (a2) REFERENCES t1(a1) ON DELETE CASCADE,
+FULLTEXT KEY (b2,a2)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(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 ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+DELETE 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) ;
+id1	a1	b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id2	a2	b2
+SELECT * FROM t1 WHERE a1 LIKE '%tutorial%';
+id1	a1	b1
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+SELECT * FROM t2 WHERE a2 LIKE '%tutorial%';
+id2	a2	b2
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+DROP TABLE t2 , t1;
+DROP TABLE IF EXISTS t2,t1;
+SET NAMES utf8;
+CREATE TABLE t1 (
+id1 INT ,
+a1 VARCHAR(200) ,
+b1 TEXT ,
+FULLTEXT KEY (a1,b1), PRIMARY KEY(a1, id1)
+) CHARACTER SET = utf8 , ENGINE = InnoDB;
+CREATE TABLE t2 (
+id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a2 VARCHAR(200),
+b2 TEXT ,
+FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+FULLTEXT KEY (b2,a2)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(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 ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+START TRANSACTION;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(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 ...');
+INSERT INTO t2 (a2,b2) 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 ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+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') ;
+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') ;
+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) ;
+id1	a1	b1
+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 (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id2	a2	b2
+3	Optimizing MySQL	In this tutorial we will show ...
+2	How To Use MySQL Well	After you went through a ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ;
+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) ;
+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 ...
+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��...
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id2	a2	b2
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root') ;
+id1	a1	b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root') ;
+id2	a2	b2
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('mysqld (+root)' IN BOOLEAN MODE) ;
+id1	a1	b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('mysqld (-root)' IN BOOLEAN MODE) ;
+id2	a2	b2
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root' WITH QUERY EXPANSION) ;
+id1	a1	b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root' WITH QUERY EXPANSION) ;
+id2	a2	b2
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
+id1	a1	b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
+id2	a2	b2
+SELECT * FROM t1;
+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 ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT * FROM t2;
+id2	a2	b2
+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 ...
+COMMIT;
+START TRANSACTION;
+UPDATE t1 SET a1 = "changing column - on UPDATE cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+COMMIT;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id1	a1	b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+id2	a2	b2
+6	changing column - on UPDATE cascade	When configured properly, MySQL ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ;
+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
+5	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) ;
+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 ...
+5	changing column - on UPDATE cascade	In the following database comparison ...
+3	changing column - on UPDATE cascade	In this tutorial we will show ...
+SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%';
+id2	a2	b2
+2	changing column - on UPDATE cascade	After you went through a ...
+3	changing column - on UPDATE cascade	In this tutorial we will show ...
+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 ...
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1  WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1  WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1	s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+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),
+b TEXT
+) CHARACTER SET = utf8, ROW_FORMAT=COMPRESSED, ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `a` varchar(200) DEFAULT NULL,
+  `b` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED
+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);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+3	Optimizing MySQL	In this tutorial we will show ...
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +V����W��" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+select * from t1 where MATCH(a,b) AGAINST("+-V����W��" IN BOOLEAN MODE);
+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);
+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;
+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
+3	Optimizing MySQL	In this tutorial we will show ...	0.000000001885928302414186
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...	0.000000001885928302414186
+5	MySQL vs. YourSQL	In the following database comparison ...	0.000000001885928302414186
+6	MySQL Security	When configured properly, MySQL ...	0.000000003771856604828372
+select * from t1 where MATCH a,b AGAINST ("+database* +V����W*" IN BOOLEAN MODE);
+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);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+3	Optimizing MySQL	In this tutorial we will show ...
+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);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+3	Optimizing MySQL	In this tutorial we will show ...
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +V����W��" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+select * from t1 where MATCH(a,b) AGAINST("+dbms" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+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);
+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;
+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
+3	Optimizing MySQL	In this tutorial we will show ...	0.000000001885928302414186
+4	1001 MySQL Tricks	1. Never run mysqld as root. 2. ...	0.000000001885928302414186
+5	MySQL vs. YourSQL	In the following database comparison ...	0.000000001885928302414186
+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);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase V����W��...
+3	Optimizing MySQL	In this tutorial we will show ...
+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',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id	a	b
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+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);
+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 ('"more test proximity"@2' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id	a	b
+10	test more proximity fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more fts proximity"@03' IN BOOLEAN MODE);
+id	a	b
+10	test more proximity fts search, test, more proximity and phrase	search, with proximity innodb
+UPDATE t1 SET a = UPPER(a) , b = UPPER(b) ;
+UPDATE t1 SET a = UPPER(a) , b = LOWER(b) ;
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +dbms" IN BOOLEAN MODE);
+id	a	b
+1	MYSQL TUTORIAL	dbms stands for database v����wi...
+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);
+id	a	b
+1	MYSQL TUTORIAL	dbms stands for database v����wi...
+3	OPTIMIZING MYSQL	in this tutorial we will show ...
+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);
+SELECT * FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+SELECT * FROM t1;
+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. ...
+5	MYSQL VS. YOURSQL	in the following database comparison ...
+6	MYSQL SECURITY	when configured properly, mysql ...
+7	TEST QUERY EXPANSION	for database ...
+DROP TABLE t1;
+SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_per_table=1;
+SET GLOBAL innodb_file_format_max=Antelope;
+SET GLOBAL innodb_large_prefix=0;
+set names utf8;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = utf8, ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('�� �������� �������� ������������', '������ ������ ���� ������������'),
+('�������� ���� ���� ������������', '���� ���� ���� ����������'),
+('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+('P����li�� ��lu��ou��k�� k����', '��p��l ����belsk�� k��dy'),
+('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t'),
+('���������������������','���������������'),
+('������������������������������������','���������������������������������������');
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam at oraclehelp.com ...')  ,
+('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...')  ,
+('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+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 ("������������ �����������");
+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);
+id	a	b
+1	�� �������� �������� ������������	������ ������ ���� ������������
+2	�������� ���� ���� ������������	���� ���� ���� ����������
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+������������� +tutorial" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+tutorial +(�������� ������������)" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("���������������������������������������");
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("������������" WITH QUERY EXPANSION);
+id	a	b
+7	������������������������������������	���������������������������������������
+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);
+id	a	b
+6	���������������������	���������������
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+S��v��r +��lpan" IN BOOLEAN MODE);
+id	a	b
+5	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"������������� �����������"@2' IN BOOLEAN MODE);
+id	a	b
+3	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"query performace"@02' IN BOOLEAN MODE);
+id	a	b
+9	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"�������� ������������"@2' IN BOOLEAN MODE);
+id	a	b
+3	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"��������������������� ���������������"@1' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"��������������������� ���������������"@2' IN BOOLEAN MODE);
+id	a	b
+7	������������������������������������	���������������������������������������
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("��������������������� ���������������");
+id	a	b
+7	������������������������������������	���������������������������������������
+UPDATE t1 SET a = "Pchn���� w t�� ����d�� je��a" , b = "lub osiem skrzy�� fig" WHERE MATCH(a,b) AGAINST ("��������������������� ���������������");
+UPDATE t1 SET a = "�� ���������� ������ ������-������ ������������? ����", b = "���� ������������������ ������������������! ����" WHERE MATCH(a,b) AGAINST ("��������*" IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+S��v��r +��lpan" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("���������������������������������������");
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("����d�� osiem");
+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);
+id	a	b
+1	�� ���������� ������ ������-������ ������������? ����	���� ������������������ ������������������! ����
+2	�� ���������� ������ ������-������ ������������? ����	���� ������������������ ������������������! ����
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+S��v��r +��lpan" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+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;
+id	a	b
+1	�� ���������� ������ ������-������ ������������? ����	���� ������������������ ������������������! ����
+2	�� ���������� ������ ������-������ ������������? ����	���� ������������������ ������������������! ����
+3	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+4	P����li�� ��lu��ou��k�� k����	��p��l ����belsk�� k��dy
+6	���������������������	���������������
+7	Pchn���� w t�� ����d�� je��a	lub osiem skrzy�� fig
+8	MySQL Tutorial	request docteam at oraclehelp.com ...
+9	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+10	when To Use MySQL Well	for free faq  mail at xyz.com ...
+DROP TABLE t1;
+CREATE TABLE t1(ID INT PRIMARY KEY,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+ID	no_fts_field	fts_field
+1	AAA	BBB
+UPDATE t1 SET fts_field='anychange' where id = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+ID	no_fts_field	fts_field
+1	AAA	anychange
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+ID	no_fts_field	fts_field
+1	anychange	anychange
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+ID	no_fts_field	fts_field
+1	anychange	other
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+ID	no_fts_field	fts_field
+DROP INDEX f on t1;
+UPDATE t1 SET fts_field='anychange' where id = 1;
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+CREATE FULLTEXT INDEX f ON t1(FTS_FIELD);
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+ID	no_fts_field	fts_field
+1	anychange	other
+DROP TABLE t1;
+CREATE TABLE t1(`FTS_DOC_ID` serial,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+UPDATE t1 SET fts_field='anychange' where FTS_DOC_ID = 1;
+ERROR HY000: Invalid InnoDB FTS Doc ID
+UPDATE t1 SET fts_field='anychange', FTS_DOC_ID = 2 where FTS_DOC_ID = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+FTS_DOC_ID	no_fts_field	fts_field
+2	AAA	anychange
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+FTS_DOC_ID	no_fts_field	fts_field
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+FTS_DOC_ID	no_fts_field	fts_field
+2	anychange	anychange
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where FTS_DOC_ID = 2;
+ERROR HY000: Invalid InnoDB FTS Doc ID
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+FTS_DOC_ID	no_fts_field	fts_field
+UPDATE t1 SET  FTS_DOC_ID = 1 where FTS_DOC_ID = 2;
+ERROR HY000: Invalid InnoDB FTS Doc ID
+DROP INDEX f ON t1;
+UPDATE t1 SET fts_field='newchange' where FTS_DOC_ID = 2;
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+SELECT * FROM t1;
+FTS_DOC_ID	no_fts_field	fts_field
+2	anychange	newchange
+DROP TABLE t1;
+CREATE TABLE t1(ID INT PRIMARY KEY,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field), index k(fts_field)) ENGINE=INNODB;
+CREATE TABLE t2(ID INT PRIMARY KEY,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field),
+INDEX k2(fts_field),
+FOREIGN KEY(fts_field) REFERENCES
+t1(fts_field) ON UPDATE CASCADE) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+INSERT INTO t2 VALUES (1, 'AAA', 'BBB');
+update t1 set fts_field='newchange' where id =1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+ID	no_fts_field	fts_field
+SELECT * FROM t2 WHERE MATCH(fts_field) against("BBB");
+ID	no_fts_field	fts_field
+SELECT * FROM t1 WHERE MATCH(fts_field) against("newchange");
+ID	no_fts_field	fts_field
+1	AAA	newchange
+SELECT * FROM t2 WHERE MATCH(fts_field) against("newchange");
+ID	no_fts_field	fts_field
+1	AAA	newchange
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1(id INT PRIMARY KEY,
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY,
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+INSERT INTO t1 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800'),(9,'900'),(10,'1000'),(11,'1100'),(12,'1200');
+INSERT INTO t2 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800');
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo');
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo') WHERE t1.fts_field = "100foo";
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'xoo'), t2.fts_field = CONCAT(t1.fts_field, 'xoo') where t1.fts_field=CONCAT(t2.fts_field, 'foo');
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foofoo");
+id	fts_field
+1	100foofoo
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foo");
+id	fts_field
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100");
+id	fts_field
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400fooxoo");
+id	fts_field
+4	400fooxoo
+SELECT * FROM t2 WHERE MATCH(fts_field) against("100");
+id	fts_field
+1	100
+SELECT * FROM t2 WHERE MATCH(fts_field) against("200");
+id	fts_field
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400");
+id	fts_field
+DROP TABLE t1;
+DROP TABLE t2;
+
+BUG#13701973/64274: MYSQL THREAD WAS SUSPENDED WHEN EXECUTE UPDATE QUERY
+
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1 (
+t1_id INT(10) UNSIGNED NOT NULL,
+t2_id INT(10) UNSIGNED DEFAULT NULL,
+PRIMARY KEY (t1_id),
+FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+t1_id INT(10) UNSIGNED NOT NULL,
+t2_id INT(10) UNSIGNED NOT NULL,
+t3_id INT(10) UNSIGNED NOT NULL,
+t4_id INT(10) UNSIGNED NOT NULL,
+PRIMARY KEY (t2_id),
+FOREIGN KEY (t1_id) REFERENCES t1 (t1_id),
+FOREIGN KEY (t3_id) REFERENCES t3 (t3_id)
+ON DELETE CASCADE ON UPDATE CASCADE,
+FOREIGN KEY (t4_id) REFERENCES t4 (t4_id)
+) ENGINE=InnoDB;
+CREATE TABLE t3 (
+t3_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+payload char(3),
+PRIMARY KEY (t3_id)
+) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (1, '100');
+CREATE TABLE t4 (
+t2_id INT(10) UNSIGNED DEFAULT NULL,
+t4_id INT(10) UNSIGNED NOT NULL,
+PRIMARY KEY (t4_id),
+FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=1;
+UPDATE t3 SET payload='101' WHERE t3_id=1;
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_misc_debug.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_debug.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_debug.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,96 @@
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+DROP INDEX title ON articles;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+BEGIN;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+SET SESSION debug="+d,crash_commit_before";
+COMMIT;
+ERROR HY000: Lost connection to MySQL server during query
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+CREATE FULLTEXT INDEX idx ON articles (title,body);
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+7	MySQL Tutorial	DBMS stands for DataBase ...
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+BEGIN;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+SET SESSION debug="+d,crash_commit_before";
+COMMIT;
+ERROR HY000: Lost connection to MySQL server during query
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+5	MySQL vs. YourSQL	In the following database comparison ...
+7	MySQL Tutorial	DBMS stands for DataBase ...
+8	MySQL Tutorial	DBMS stands for DataBase ...
+12	MySQL vs. YourSQL	In the following database comparison ...
+14	MySQL Tutorial	DBMS stands for DataBase ...
+DROP TABLE articles;
+CREATE TABLE articles (
+id int PRIMARY KEY,
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+CREATE FULLTEXT INDEX idx1 on articles (title, body);
+INSERT INTO articles VALUES
+(1, 10, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+(2, 1, 'How To Use MySQL Well','After you went through a ...'),
+(3, 2, 'Optimizing MySQL','In this tutorial we will show ...'),
+(4, 11, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'),
+(7, 4, 'MySQL Security','When configured properly, MySQL ...');
+BEGIN;
+INSERT INTO articles VALUES
+(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
+SET SESSION debug="+d,crash_commit_before";
+COMMIT;
+ERROR HY000: Lost connection to MySQL server during query
+INSERT INTO articles VALUES         (8, 12, 'MySQL Tutorial','DBMS stands for DataBase ...');
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	FTS_DOC_ID	title	body
+3	2	Optimizing MySQL	In this tutorial we will show ...
+1	10	MySQL Tutorial	DBMS stands for DataBase ...
+8	12	MySQL Tutorial	DBMS stands for DataBase ...
+DROP TABLE articles;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+SET SESSION debug="+d,ib_dict_create_index_tree_fail";
+CREATE FULLTEXT INDEX idx ON articles(body);
+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
+SET SESSION debug="-d,ib_dict_create_index_tree_fail";
+ALTER TABLE articles STATS_PERSISTENT=DEFAULT;
+DROP TABLE articles;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,213 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB STATS_PERSISTENT=0;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_1 (a);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_2 (b);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `a` varchar(200) DEFAULT NULL,
+  `b` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx_1` (`a`),
+  FULLTEXT KEY `idx_2` (`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 STATS_PERSISTENT=0
+START TRANSACTION;
+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 ...');
+ROLLBACK;
+SELECT * FROM t1 WHERE MATCH (a)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(a) AGAINST("+mysql +Tutorial" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(b) AGAINST("+Tutorial" IN BOOLEAN MODE);
+id	a	b
+3	Optimizing MySQL	In this tutorial we will show ...
+select * from t1 where MATCH(b) AGAINST("+stands +(DataBase)" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(b) AGAINST("+DataBase -(comparison)" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1;
+id	a	b	x
+1	MySQL Tutorial	DBMS stands for DataBase ...	0.0906190574169159
+2	How To Use MySQL Well	After you went through a ...	0.0906190574169159
+3	Optimizing MySQL	In this tutorial we will show ...	0.6961383819580078
+select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id	a	b	x
+1	MySQL Tutorial	DBMS stands for DataBase ...	0
+2	How To Use MySQL Well	After you went through a ...	0
+3	Optimizing MySQL	In this tutorial we will show ...	0
+select * from t1 where MATCH a AGAINST ("+Optimiz* +Optimiz*" IN BOOLEAN MODE);
+id	a	b
+3	Optimizing MySQL	In this tutorial we will show ...
+select * from t1 where MATCH b AGAINST ('"DBMS stands"' IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH b AGAINST ('"DBMS STANDS"' IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(b) AGAINST ("DataBase" WITH QUERY EXPANSION);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(a) AGAINST ("Security" WITH QUERY EXPANSION);
+id	a	b
+ALTER TABLE t1 DROP INDEX idx_1;
+ALTER TABLE t1 DROP INDEX idx_2;
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_1 (a);
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_2 (b);
+SELECT * FROM t1 WHERE MATCH (a)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(a) AGAINST("+mysql +Tutorial" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(b) AGAINST("+Tutorial" IN BOOLEAN MODE);
+id	a	b
+3	Optimizing MySQL	In this tutorial we will show ...
+select * from t1 where MATCH(b) AGAINST("+stands +(DataBase)" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(b) AGAINST("+DataBase -(comparison)" IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1;
+id	a	b	x
+1	MySQL Tutorial	DBMS stands for DataBase ...	0.0906190574169159
+2	How To Use MySQL Well	After you went through a ...	0.0906190574169159
+3	Optimizing MySQL	In this tutorial we will show ...	0.6961383819580078
+select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id	a	b	x
+1	MySQL Tutorial	DBMS stands for DataBase ...	0
+2	How To Use MySQL Well	After you went through a ...	0
+3	Optimizing MySQL	In this tutorial we will show ...	0
+select * from t1 where MATCH a AGAINST ("+Optimiz* +Optimiz*" IN BOOLEAN MODE);
+id	a	b
+3	Optimizing MySQL	In this tutorial we will show ...
+select * from t1 where MATCH b AGAINST ('"DBMS stands"' IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH b AGAINST ('"DBMS STANDS"' IN BOOLEAN MODE);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(b) AGAINST ("DataBase" WITH QUERY EXPANSION);
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+select * from t1 where MATCH(a) AGAINST ("Security" WITH QUERY EXPANSION);
+id	a	b
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+INSERT INTO t1 (a,b) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more of proximity for fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT * FROM t1
+WHERE MATCH (a)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+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
+SELECT * FROM t1
+WHERE MATCH (a)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id	a	b
+8	test proximity search, test, proximity and phrase	search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (b)
+AGAINST ('"proximity innodb"@4' IN BOOLEAN MODE);
+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 of proximity for fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+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 of proximity for fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id	a	b
+10	test more of proximity for fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a)
+AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a)
+AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 WHERE
+MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+) OR t1.id = 3 ;
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT * FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2
+WHERE MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t2.id != 3) ;
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE
+MATCH (b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+id	a	b
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT * FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1
+WHERE MATCH (b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ;
+id	a	b
+1	MySQL Tutorial	DBMS stands for DataBase ...
+2	How To Use MySQL Well	After you went through a ...
+7	test query expansion	for database ...
+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 of proximity for fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+id	a	b
+3	Optimizing MySQL	In this tutorial we will show ...
+SELECT * FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+id	a	b
+2	How To Use MySQL Well	After you went through a ...
+3	Optimizing MySQL	In this tutorial we will show ...
+7	test query expansion	for database ...
+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 of proximity for fts search, test, more proximity and phrase	search, with proximity innodb
+SELECT * FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a) AGAINST ('"proximity search"@3' IN BOOLEAN MODE));
+id	a	b
+9	test proximity fts search, test, proximity and phrase	search, with proximity innodb
+SELECT * FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.b) AGAINST ('"proximity innodb"@3' IN BOOLEAN MODE));
+id	a	b
+9	test proximity fts search, test, proximity and phrase	search, with proximity innodb
+10	test more of proximity for fts search, test, more proximity and phrase	search, with proximity innodb
+DROP TABLE t1;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_opt.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_opt.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_opt.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,827 @@
+CREATE TABLE wp(
+FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+title VARCHAR(255) NOT NULL DEFAULT '',
+text MEDIUMTEXT NOT NULL,
+dummy INTEGER,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY idx (title,text) 
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO wp (title, text) 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','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database to database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE TABLE t1 (i INTEGER);
+INSERT INTO t1 SELECT FTS_DOC_ID FROM wp;
+ANALYZE TABLE t1;
+ANALYZE TABLE wp;
+SELECT FTS_DOC_ID, title, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp;
+FTS_DOC_ID	title	score1	score2
+1	MySQL Tutorial	0.22764469683170319	0.000000003771856604828372
+2	How To Use MySQL Well	0	0.000000001885928302414186
+3	Optimizing MySQL	0	0.000000001885928302414186
+4	1001 MySQL Tricks	0	0.000000001885928302414186
+5	MySQL vs. YourSQL	0.45528939366340637	0.000000001885928302414186
+6	MySQL Security	0	0.000000003771856604828372
+No sorting for this query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+No sorting for this query even if MATCH is part of an expression
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') > 0.1
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+No sorting even if there are several MATCH expressions as long as the
+right one is used in ORDER BY
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score1 DESC;
+title	score1	score2
+MySQL vs. YourSQL	0.45528939366340637	0.000000001885928302414186
+MySQL Tutorial	0.22764469683170319	0.000000003771856604828372
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+Sorting since it is not a single table query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID = t1.i
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting since there is no WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+Optimizing MySQL	0
+1001 MySQL Tricks	0
+MySQL Security	0
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	6
+Sorting since ordering on multiple columns
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC, FTS_DOC_ID;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting since ordering is not descending
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score ASC;
+title	score
+MySQL Tutorial	0.22764469683170319
+MySQL vs. YourSQL	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting because one is ordering on a different MATCH expression
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('mysql') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title	score
+MySQL Tutorial	0.000000003771856604828372
+MySQL vs. YourSQL	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+No sorting for this query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+Revert to table scan and sorting for this query since not
+enough matching rows to satisfy LIMIT clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 3;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	1
+Handler_read_key	4
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	3
+Handler_read_rnd_next	7
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	3
+Sorting since no LIMIT clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+Optimizing MySQL	0
+1001 MySQL Tricks	0
+MySQL Security	0
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	6
+Sorting since there is a WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp
+WHERE dummy IS NULL
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting since ordering is not on a simple MATCH expressions
+FLUSH STATUS;
+SELECT title, (MATCH(title, text) AGAINST ('database')) * 100 AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	45.52893936634064
+MySQL Tutorial	22.76446968317032
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+No ordinary handler accesses when only accessing FTS_DOC_ID and MATCH
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score
+5	0.45528939366340637
+1	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Still no handler accesses when adding FTS_DOC_ID to WHERE clause
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID > 2;
+docid	score
+5	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Still no handler accesses when ordering by MATCH expression
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score;
+docid	score
+1	0.22764469683170319
+5	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	2
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+Optimization is disabled when ordering on FTS_DOC_ID
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY 1 DESC;
+docid	score
+5	0.45528939366340637
+1	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	2
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+Optimization also work with several MATCH expressions
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score1	score2
+5	0.45528939366340637	0.000000001885928302414186
+1	0.22764469683170319	0.000000003771856604828372
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Optimization does not apply if sorting on a different MATCH expressions
+from the one used to access the 
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score2 DESC;
+docid	score1	score2
+1	0.22764469683170319	0.000000003771856604828372
+5	0.45528939366340637	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	2
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+FLUSH STATUS;
+Optimization does not apply for GROUP BY
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') AS score
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+GROUP BY score;
+FTS_DOC_ID	score
+1	0.22764469683170319
+5	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	3
+No sorting and no table access with LIMIT clause and only information
+from FTS result
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+5	0.45528939366340637
+1	0.22764469683170319
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+If count optimization applies, EXPLAIN shows 
+"Select tables optimized away."
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+Verify that there was no table access
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Optimization applies also to COUNT(expr) as long as expr is not nullable
+EXPLAIN SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(title)
+2
+Optimization does not apply if not a single table query.
+EXPLAIN SELECT count(*)
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database');
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	6	NULL
+SELECT count(*)
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database');
+count(*)
+12
+Optimization does not apply if MATCH is part of an expression
+EXPLAIN SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+COUNT(title)
+2
+Optimization does not apply if MATCH is part of an expression
+EXPLAIN SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+COUNT(title)
+2
+Optimization does not apply if COUNT expression is nullable
+EXPLAIN SELECT COUNT(dummy) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+SELECT COUNT(dummy) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(dummy)
+0
+FLUSH STATUS;
+SELECT title, 
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	2.2718474864959717
+MySQL Tutorial	1.6663280725479126
+Optimizing MySQL	0.22764469683170319
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+1001 MySQL Tricks	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	2.2718474864959717
+MySQL Tutorial	1.6663280725479126
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score
+5	2.2718474864959717
+1	1.6663280725479126
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+5	2.2718474864959717
+1	1.6663280725479126
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+6
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT title, 
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title	score
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+Optimizing MySQL	0.000000001885928302414186
+1001 MySQL Tricks	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database');
+docid	score
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+6	0.000000003771856604828372
+2	0.000000001885928302414186
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+COUNT(*)
+4
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title	score
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+title	score
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5');
+docid	score
+1	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+docid	score
+1	0.22764469683170319
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+EXPLAIN SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE);
+COUNT(*)
+1
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SELECT title,
+MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+Optimizing MySQL	0
+1001 MySQL Tricks	0
+MySQL Security	0
+SELECT title,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('MySQL database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+title	score
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+Optimizing MySQL	0.000000001885928302414186
+1001 MySQL Tricks	0.000000001885928302414186
+MySQL Tutorial	0
+MySQL vs. YourSQL	0
+SELECT title,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title	score
+MySQL Tutorial	0
+ALTER TABLE wp ENGINE=myisam;
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.9562782645225525
+MySQL Tutorial	0.5756555199623108
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	1
+Sort_rows	2
+Sort_scan	0
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	0.9562782645225525
+MySQL Tutorial	0.5756555199623108
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	1
+Sort_rows	2
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score
+5	0.9562782645225525
+1	0.5756555199623108
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	3
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+5	0.9562782645225525
+1	0.5756555199623108
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	3
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	1
+Sort_rows	2
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	3
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+DROP TABLE wp, t1;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,228 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE= InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("where will");
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("when");
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("what" WITH QUERY EXPANSION);
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("whe*" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+what +will" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+from" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id	a	b
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam at oraclehelp.com ...')  ,
+('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...')  ,
+('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"request"@10' IN BOOLEAN MODE);
+id	a	b
+4	MySQL Tutorial	request docteam at oraclehelp.com ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"Trial version"@0' IN BOOLEAN MODE);
+id	a	b
+5	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"request docteam at oraclehelp.com"@10' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"1255 minute"@1' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"1255 minute"@2' IN BOOLEAN MODE);
+id	a	b
+5	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"1255"@10' IN BOOLEAN MODE);
+id	a	b
+5	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('1255' WITH QUERY EXPANSION);
+id	a	b
+5	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"request docteam"@2' IN BOOLEAN MODE);
+id	a	b
+4	MySQL Tutorial	request docteam at oraclehelp.com ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"1255 minute"' IN BOOLEAN MODE);
+id	a	b
+5	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request docteam at oraclehelp.com');
+id	a	b
+4	MySQL Tutorial	request docteam at oraclehelp.com ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"MySQL request"@3' IN BOOLEAN MODE);
+id	a	b
+4	MySQL Tutorial	request docteam at oraclehelp.com ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"Trial memory"@10' IN BOOLEAN MODE);
+id	a	b
+5	Trial version	query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"Trial memory"@9' IN BOOLEAN MODE);
+id	a	b
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8, ENGINE= InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam at oraclehelp.com ...')  ,
+('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...'),
+('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"mysql use"@2' IN BOOLEAN MODE);
+id	a	b
+2	when To Use MySQL Well	After that you went through a ...
+6	when To Use MySQL Well	for free faq  mail at xyz.com ...
+SELECT * FROM t1
+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');
+Warnings:
+Warning	1265	Data truncated for column 'a' at row 1
+SELECT count(*) FROM t1
+WHERE MATCH (a,b)
+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,
+a TEXT,
+b TEXT,
+c TEXT
+) CHARACTER SET = UTF8, ROW_FORMAT=DYNAMIC, ENGINE= InnoDB;
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, long text', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, very little long blob very much blob', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000),"very ������ ��� blob","new ������������information");
+CREATE FULLTEXT INDEX idx on t1 (a,b,c);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b,c) VALUES   (repeat("x", 19000), 'new, long text', 'very new blob');
+INSERT INTO t1 (a,b,c) VALUES   ('interesting, long text', repeat("x", 19000), 'very very good new blob');
+SELECT count(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"very blob"@3' IN BOOLEAN MODE);
+count(*)
+3
+SELECT count(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"very long blob"@0' IN BOOLEAN MODE);
+count(*)
+2
+SELECT count(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"very blob"@4' IN BOOLEAN MODE);
+count(*)
+4
+SELECT count(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"interesting blob"@9' IN BOOLEAN MODE);
+count(*)
+1
+SELECT COUNT(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"interesting blob"@9  "very long blob"@0' IN BOOLEAN MODE);
+COUNT(*)
+3
+SELECT COUNT(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"very blob"@4 - "interesting blob"@9' IN BOOLEAN MODE);
+COUNT(*)
+3
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8, ENGINE= InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for    + DataBase ...');
+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 ('"stands database"@3' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for    + DataBase ...
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a TEXT,
+b TEXT,
+c TEXT
+) CHARACTER SET = UTF8, ROW_FORMAT=DYNAMIC, ENGINE= InnoDB;
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, long text', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   ('XYZ, ������ very little long blob very much blob', repeat("b", 19000), 'very long but smaller blob');
+CREATE FULLTEXT INDEX idx on t1 (a,b,c);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+DELETE FROM t1;
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, long text', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   ('XYZ, ������ very little long blob is a very much longer blob', repeat("b", 19000), 'this is very long but smaller blob');
+SELECT count(*) FROM t1
+WHERE MATCH (a,b,c)
+AGAINST ('"very blob"@4' IN BOOLEAN MODE);
+count(*)
+2
+SELECT count(*) FROM t1
+WHERE MATCH (a,b,c)
+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;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_transaction.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_transaction.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_transaction.result	2013-08-07 09:55:00 +0000
@@ -0,0 +1,1048 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB STATS_PERSISTENT=0;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam for oraclehelp.');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request' IN NATURAL LANGUAGE MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('-request +MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE);
+id	a	b
+2	when To Use MySQL Well	After that you went through a ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"stands Database"@11' IN BOOLEAN MODE) ORDER BY 1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+2	when To Use MySQL Well	After that you went through a ...
+COMMIT;
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	MySQL Tutorial	request docteam for oraclehelp.
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request MySQL' IN BOOLEAN MODE);
+id	a	b
+4	MySQL Tutorial	request docteam for oraclehelp.
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+4	MySQL Tutorial	request docteam for oraclehelp.
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+2	when To Use MySQL Well	After that you went through a ...
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+id	a	b
+4	MySQL Tutorial	request docteam for oraclehelp.
+UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...'
+WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('query performace' IN BOOLEAN MODE);
+id	a	b
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq  xyz.com ...'
+WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('performace');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+id	a	b
+COMMIT;
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1;
+id	a	b
+4	Trial version	query performace 1255 minute on 2.1Hz Memory 2GB...
+5	NULL	NULL
+INSERT INTO t1 (a,b) VALUES
+('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...')  ,
+('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+SELECT * FROM t1;
+id	a	b
+4	Trial version	query performace 1255 minute on 2.1Hz Memory 2GB...
+5	NULL	NULL
+6	Trial version	query performace 1255 minute on 2.1Hz Memory 2GB...
+7	when To Use MySQL Well	for free faq  mail at xyz.com ...
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam for oraclehelp.');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request' IN NATURAL LANGUAGE MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('-request +MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE);
+id	a	b
+2	when To Use MySQL Well	After that you went through a ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+2	when To Use MySQL Well	After that you went through a ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+2	when To Use MySQL Well	After that you went through a ...
+ROLLBACK;
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+2	when To Use MySQL Well	After that you went through a ...
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...'
+WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('query performace' IN BOOLEAN MODE);
+id	a	b
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq  xyz.com ...'
+WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('performace');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+id	a	b
+ROLLBACK;
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1;
+id	a	b
+INSERT INTO t1 (a,b) VALUES
+('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...')  ,
+('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+SELECT * FROM t1;
+id	a	b
+6	Trial version	query performace 1255 minute on 2.1Hz Memory 2GB...
+7	when To Use MySQL Well	for free faq  mail at xyz.com ...
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam for oraclehelp.');
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+id	a	b
+4	MySQL Tutorial	request docteam for oraclehelp.
+UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...' WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+SELECT * from t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	Trial version	query performace 1255 minute on 2.1Hz Memory 2GB...
+5	NULL	NULL
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('query performace' IN BOOLEAN MODE);
+id	a	b
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq mail xyz.com ...' WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE);
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq mail xyz.com ...' WHERE b like '%query performace%';
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('performace');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+id	a	b
+SELECT * from t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	when To Use MySQL Well	for free faq mail xyz.com ...
+5	NULL	NULL
+COMMIT;
+SELECT * from t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	when To Use MySQL Well	for free faq mail xyz.com ...
+5	NULL	NULL
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1;
+id	a	b
+5	NULL	NULL
+INSERT INTO t1 (a,b) VALUES
+('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...')  ,
+('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+SELECT * FROM t1;
+id	a	b
+5	NULL	NULL
+6	Trial version	query performace 1255 minute on 2.1Hz Memory 2GB...
+7	when To Use MySQL Well	for free faq  mail at xyz.com ...
+DROP TABLE t1;
+SET NAMES UTF8;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8,ENGINE = InnoDB;
+"In connection 1"
+SET NAMES UTF8;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('�� �������� �������� ������������', '������ ������ M���� ������������'),
+('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+"In connection 2"
+SET NAMES UTF8;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+"In connection 1"
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+INSERT INTO t1 (a,b) VALUES
+('adding record using session 1','for verifying multiple concurrent transactions'),
+('�������� ���� ���� ������������', '���� M���� ���� ����������');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+������������� +���������*' IN BOOLEAN MODE);
+id	a	b
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam for oraclehelp.'),
+('P����li�� ��lu��ou��k�� k����', '��p��l ����belsk�� k��dy');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request ����belsk��' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY 1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+"In connection 2"
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+record +multiple' IN BOOLEAN MODE);
+id	a	b
+7	adding record using session 1	for verifying multiple concurrent transactions
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutor* S��v��*' IN BOOLEAN MODE) ORDER BY 1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('usin* multipl*' IN BOOLEAN MODE);
+id	a	b
+7	adding record using session 1	for verifying multiple concurrent transactions
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"request docteam"@08' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request' IN NATURAL LANGUAGE MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('-request +MySQL' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE);
+id	a	b
+2	when To Use MySQL Well	After that you went through a ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"stands Database"@11' IN BOOLEAN MODE) ORDER BY 1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY 1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+"In connection 1"
+COMMIT;
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+id	a	b
+9	MySQL Tutorial	request docteam for oraclehelp.
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('P����li�� ��lu��ou��k��' IN BOOLEAN MODE);
+id	a	b
+10	P����li�� ��lu��ou��k�� k����	��p��l ����belsk�� k��dy
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('P����li��');
+id	a	b
+10	P����li�� ��lu��ou��k�� k����	��p��l ����belsk�� k��dy
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+SELECT * FROM t1 WHERE a IS NULL AND b IS NULL;
+id	a	b
+11	NULL	NULL
+"In connection 2"
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('usin* multipl*' IN BOOLEAN MODE);
+id	a	b
+7	adding record using session 1	for verifying multiple concurrent transactions
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+id	a	b
+9	MySQL Tutorial	request docteam for oraclehelp.
+SELECT * FROM t1 WHERE a IS NULL AND b IS NULL;
+id	a	b
+11	NULL	NULL
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+START TRANSACTION;
+UPDATE t1 SET a = 'Trial version P����li�� ��lu��ou��k��' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...'
+WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+query +performace' IN BOOLEAN MODE);
+id	a	b
+UPDATE t1 SET a = UPPER(a) WHERE MATCH (a,b) AGAINST ('+P����li�� +��lu��ou��k��' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+P����li�� +��lu��ou��k��' IN BOOLEAN MODE);
+id	a	b
+UPDATE t1 SET a = UPPER(a) WHERE a LIKE '%version P����li��%';
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+query +performace' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1 WHERE b LIKE '%query performace%';
+id	a	b
+9	TRIAL VERSION P����LI�� ��LU��OU��K��	query performace 1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('request');
+id	a	b
+"In connection 1"
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('query performace' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('performace');
+id	a	b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+id	a	b
+"In connection 2"
+COMMIT;
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+query +performace' IN BOOLEAN MODE);
+id	a	b
+9	TRIAL VERSION P����LI�� ��LU��OU��K��	query performace 1255 minute on 2.1Hz Memory 2GB...
+"In connection 1"
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('+query +performace' IN BOOLEAN MODE);
+id	a	b
+9	TRIAL VERSION P����LI�� ��LU��OU��K��	query performace 1255 minute on 2.1Hz Memory 2GB...
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq  xyz.com ...'
+WHERE MATCH (a,b) AGAINST ('+�������� +������������' IN BOOLEAN MODE);
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('well free') ORDER BY 1;
+id	a	b
+2	when To Use MySQL Well	After that you went through a ...
+5	when To Use MySQL Well	for free faq  xyz.com ...
+DROP TABLE t1;
+SET NAMES UTF8;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8,ENGINE = InnoDB;
+"In connection 1"
+SET NAMES UTF8;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('�� �������� �������� ������������', '������ ������ M���� ������������'),
+('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+"In connection 2"
+SET NAMES UTF8;
+select @@session.tx_isolation;
+@@session.tx_isolation
+REPEATABLE-READ
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('adding record using session 1','for verifying multiple concurrent transactions'),
+('�������� ���� ���� ������������', '���� M���� ���� ����������');
+"In connection 1"
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+7	adding record using session 1	for verifying multiple concurrent transactions
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+id	a	b
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+7	adding record using session 1	for verifying multiple concurrent transactions
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+7	adding record using session 1	for verifying multiple concurrent transactions
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+7	adding record using session 1	for verifying multiple concurrent transactions
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+"In connection 1"
+COMMIT;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+7	adding record using session 1	for verifying multiple concurrent transactions
+DROP TABLE t1;
+SET NAMES UTF8;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8,ENGINE = InnoDB;
+"In connection 1"
+SET NAMES UTF8;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('�� �������� �������� ������������', '������ ������ M���� ������������');
+"In connection 2"
+SET NAMES UTF8;
+select @@session.tx_isolation;
+@@session.tx_isolation
+REPEATABLE-READ
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('adding record using session 1','for verifying multiple concurrent transactions'),
+('�������� ���� ���� ������������', '���� M���� ���� ����������');
+"In connection 1"
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+UPDATE t1 SET a =  '����������� ����� ������ ����������������' , b = '������������� ����������� ����� �������� ������������' WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+INSERT INTO t1(a,b) VALUES ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+"In connection 1"
+COMMIT;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+DROP TABLE t1;
+SET NAMES UTF8;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8,ENGINE = InnoDB;
+"In connection 1"
+SET NAMES UTF8;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('�� �������� �������� ������������', '������ ������ M���� ������������'),
+('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+"In connection 2"
+SET NAMES UTF8;
+select @@session.tx_isolation;
+@@session.tx_isolation
+REPEATABLE-READ
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('adding record using session 1','for verifying multiple concurrent transactions'),
+('�������� ���� ���� ������������', '���� M���� ���� ����������');
+"In connection 1"
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+7	adding record using session 1	for verifying multiple concurrent transactions
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+id	a	b
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+7	adding record using session 1	for verifying multiple concurrent transactions
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+7	adding record using session 1	for verifying multiple concurrent transactions
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+7	adding record using session 1	for verifying multiple concurrent transactions
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+"In connection 1"
+ROLLBACK;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+6	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+7	adding record using session 1	for verifying multiple concurrent transactions
+8	�������� ���� ���� ������������	���� M���� ���� ����������
+DROP TABLE t1;
+SET NAMES UTF8;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = UTF8,ENGINE = InnoDB;
+"In connection 1"
+SET NAMES UTF8;
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('�� �������� �������� ������������', '������ ������ M���� ������������');
+"In connection 2"
+SET NAMES UTF8;
+select @@session.tx_isolation;
+@@session.tx_isolation
+REPEATABLE-READ
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+INSERT INTO t1 (a,b) VALUES
+('adding record using session 1','for verifying multiple concurrent transactions'),
+('�������� ���� ���� ������������', '���� M���� ���� ����������');
+"In connection 1"
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+UPDATE t1 SET a =  '����������� ����� ������ ����������������' , b = '������������� ����������� ����� �������� ������������' WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+INSERT INTO t1(a,b) VALUES ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	����������� ����� ������ ����������������	������������� ����������� ����� �������� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+7	S��v��r gr��t	����an ��v�� ��lpan var ��n��t
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+"In connection 1"
+ROLLBACK;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+"In connection 2"
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+id	a	b
+4	�� �������� �������� ������������	������ ������ M���� ������������
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+id	a	b
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+id	a	b
+SELECT * FROM t1;
+id	a	b
+1	MySQL from Tutorial	DBMS stands for DataBase ...
+2	when To Use MySQL Well	After that you went through a ...
+3	where will Optimizing MySQL	what In this tutorial we will show ...
+4	�� �������� �������� ������������	������ ������ M���� ������������
+5	adding record using session 1	for verifying multiple concurrent transactions
+6	�������� ���� ���� ������������	���� M���� ���� ����������
+DROP TABLE t1;

=== added directory 'mysql-test/suite/innodb_fts/t'
=== added file 'mysql-test/suite/innodb_fts/t/fulltext.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,676 @@
+#
+# Test of fulltext index
+#
+
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+                       ('Full-text indexes', 'are called collections'),
+                          ('Only MyISAM tables','support collections'),
+             ('Function MATCH ... AGAINST()','is used to do a search'),
+        ('Full-text search in MySQL', 'implements vector space model');
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+SHOW INDEX FROM t1;
+
+# nl search
+
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
+select * from t1 where MATCH(a,b) AGAINST ("only");
+
+# query expansion
+
+select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+
+# IN NATURAL LANGUAGE MODE
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+--error 1064
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
+
+# add_ft_keys() tests
+
+explain select * from t1 where MATCH(a,b) AGAINST ("collections");
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0;
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1;
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0;
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1;
+explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections");
+explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections");
+explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections");
+explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections");
+explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%';
+
+# boolean search
+
+select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("support  collections" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("support +collections" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("sear*" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select *, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+
+select * from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+
+select * from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"now   support"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"text search"  "now support"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
+
+select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('+collections -supp* -foobar*' IN BOOLEAN MODE);
+
+# bug#2708, bug#3870 crash
+
+select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
+ 
+# INNODB_FTS: No FTS index on column a or b. InnoDB do now support
+# FT type search when there is no FTS INDEX
+
+# select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
+# select * from t1 where MATCH b AGAINST ("sear*" IN BOOLEAN MODE);
+
+# UNION of fulltext's
+#select * from t1 where MATCH(a,b) AGAINST ("collections") UNION ALL select * from t1 where MATCH(a,b) AGAINST ("indexes");
+
+#update/delete with fulltext index
+
+delete from t1 where a like "MySQL%";
+update t1 set a='some test foobar' where MATCH a,b AGAINST ('model');
+delete from t1 where MATCH(a,b) AGAINST ("indexes");
+select * from t1;
+drop table t1;
+
+#
+# why to scan strings for trunc*
+#
+
+create table t1 (a varchar(200) not null, fulltext (a)) engine = innodb;
+insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
+select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
+select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
+select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
+select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
+
+# FTS_INNODB: INVESTIGATE
+select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
+select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
+drop table t1;
+
+#
+# Check bug reported by Matthias Urlichs
+#
+
+CREATE TABLE t1 (
+  id int(11),
+  ticket int(11),
+  KEY ti (id),
+  KEY tit (ticket)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (2,3),(1,2);
+
+CREATE TABLE t2 (
+  ticket int(11),
+  inhalt text,
+  KEY tig (ticket),
+  fulltext index tix (inhalt)
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,'foo'),(2,'bar'),(3,'foobar');
+
+#select t1.id FROM t2 as ttxt,t1,t1 as ticket2
+#WHERE ticket2.id = ttxt.ticket AND t1.id = ticket2.ticket and
+#match(ttxt.inhalt) against ('foobar');
+
+# In the following query MySQL didn't use the fulltext index
+#select ticket2.id FROM t2 as ttxt,t2 INNER JOIN t1 as ticket2 ON
+#ticket2.id = t2.ticket
+#WHERE ticket2.id = ticket2.ticket and match(ttxt.inhalt) against ('foobar');
+
+INSERT INTO t1 VALUES (3,3);
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+select ticket2.id FROM t2 as ttxt,t2
+INNER JOIN t1 as ticket2 ON ticket2.id = t2.ticket
+WHERE ticket2.id = ticket2.ticket and
+      match(ttxt.inhalt) against ('foobar');
+
+# Check that we get 'fulltext' index in SHOW CREATE
+
+show keys from t2;
+show create table t2;
+
+# check for bug reported by Stephan Skusa
+
+select * from t2 where MATCH inhalt AGAINST (NULL);
+
+# MATCH in HAVING (pretty useless, but still it should work)
+
+select * from t2 where  MATCH inhalt AGAINST ('foobar');
+
+# INNODB_FTS: INVESTIGATE
+select * from t2 having MATCH inhalt AGAINST ('foobar');
+
+#
+# check of fulltext errors
+#
+
+--error 1283
+CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i));
+--error 1283
+CREATE TABLE t3 (t int(11),i text,
+                 j varchar(200) CHARACTER SET latin2,
+                 fulltext tix (i,j));
+
+CREATE TABLE t3 (
+  ticket int(11),
+  inhalt text,
+  KEY tig (ticket),
+  fulltext index tix (inhalt)
+) ENGINE = InnoDB;
+
+--error 1210
+select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
+--error 1191
+select * from t2 where MATCH ticket AGAINST ('foobar');
+--error 1210
+select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
+
+drop table t1,t2,t3;
+
+#
+# three more bugtests
+#
+
+CREATE TABLE t1 (
+  id int(11)  auto_increment,
+  title varchar(100)  default '',
+  PRIMARY KEY  (id),
+  KEY ind5 (title)
+) ENGINE = InnoDB;
+
+CREATE FULLTEXT INDEX ft1 ON t1(title);
+insert into t1 (title) values ('this is a test');
+select * from t1 where match title against ('test' in boolean mode);
+update t1 set title='this is A test' where id=1;
+
+check table t1;
+update t1 set title='this test once revealed a bug' where id=1;
+select * from t1;
+update t1 set title=NULL where id=1;
+
+drop table t1;
+
+# one more bug - const_table related
+
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE = InnoDB;
+insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
+SELECT * from t1 where MATCH (b) AGAINST ('apples');
+
+insert into t1 values (2,"fullaaa fullzzz");
+select * from t1 where match b against ('full*' in boolean mode);
+
+drop table t1;
+
+CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial');
+select 8 from t1;
+drop table t1;
+
+#
+# Check bug reported by Julian Ladisch
+# ERROR 1030: Got error 127 from table handler
+#
+
+create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
+insert into t1 values ('aaaa');
+
+# INNODB_FTS: InnoDB do not support "repair" command
+# repair table t1;
+select * from t1 where match (a) against ('aaaa');
+drop table t1;
+
+#
+# bug #283 by jocelyn fournier <joc at presence-pc.com>
+# FULLTEXT index on a TEXT filed converted to a CHAR field doesn't work anymore
+# 
+
+create table t1 ( ref_mag text not null, fulltext (ref_mag)) ENGINE = InnoDB;
+insert into t1 values ('test');
+select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
+alter table t1 change ref_mag ref_mag char (255) not null;
+select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
+drop table t1;
+
+#
+# bug #942: JOIN
+# NOTE: Not related to FTS, no FTS index created
+
+create table t1 (t1_id int(11) primary key, name varchar(32)) ENGINE = InnoDB;
+insert into t1 values (1, 'data1');
+insert into t1 values (2, 'data2');
+
+create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)) ENGINE = InnoDB;
+insert into t2 values (1, 1, 'xxfoo');
+insert into t2 values (2, 1, 'xxbar');
+insert into t2 values (3, 1, 'xxbuz');
+# INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support
+# Fulltext search in such case, will return 1739
+--error ER_TABLE_HAS_NO_FT
+select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
+
+#
+# Bug #7858: bug with many short (< ft_min_word_len) words in boolean search
+#
+# INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support
+# Fulltext search in such case, will return 1739
+--error ER_TABLE_HAS_NO_FT
+select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
+drop table t1,t2;
+
+#
+# bug with repair-by-sort and incorrect records estimation
+#
+
+create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
+
+#
+# UTF8
+# INNODB_FTS: Charset Support (FIX)
+SET NAMES latin1;
+CREATE TABLE t1 (t text character set utf8 not null, fulltext(t)) ENGINE = InnoDB;
+INSERT t1 VALUES ('Mit freundlichem Gr��'), ('aus Osnabr�ck');
+SET NAMES koi8r;
+INSERT t1 VALUES ("��� �� - ������"),("������, �����!"),
+                ("�� ������, �����!"),("� ����� ����!");
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('������');
+#SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('���*' IN BOOLEAN MODE);
+#SELECT * FROM t1 WHERE MATCH t AGAINST ('���' IN BOOLEAN MODE);
+#SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabr�ck');
+#SET NAMES latin1;
+#SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabr�ck');
+#SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
+#SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+#alter table t1 modify t text character set latin1 collate latin1_german2_ci not null;
+#alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
+#SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabr�ck');
+#SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
+DROP TABLE t1;
+
+#
+# bug#3964
+#
+
+CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) ENGINE = InnoDB DEFAULT CHARSET=utf8;
+insert into t1 (s) values ('p�ra para para'),('para para para');
+select * from t1 where match(s) against('para' in boolean mode);
+select * from t1 where match(s) against('par*' in boolean mode);
+DROP TABLE t1;
+
+#
+# icc -ip bug (ip = interprocedural optimization)
+# bug#5528
+#
+CREATE TABLE t1 (h text, FULLTEXT (h)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
+
+# INNODB_FTS: InnoDB do not support "repair" command
+# REPAIR TABLE t1;
+select count(*) from t1;
+drop table t1;
+
+#
+# testing out of bounds memory access in ft_nlq_find_relevance()
+# (bug#8522); visible in valgrind.
+#
+CREATE TABLE t1 ( a TEXT, FULLTEXT (a) ) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
+SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
+DROP TABLE t1;
+#
+# bug#6784
+# mi_flush_bulk_insert (on dup key error in mi_write)
+# was mangling info->dupp_key_pos
+#
+
+create table t1 (a int primary key, b text, fulltext(b)) ENGINE = InnoDB;
+create table t2 (a int, b text) ENGINE = InnoDB;
+insert t1 values (1, "aaaa"), (2, "bbbb");
+insert t2 values (10, "aaaa"), (2, "cccc");
+replace t1 select * from t2;
+drop table t1, t2;
+
+#
+# bug#8351
+#
+# INNODB_FTS: Charset Support
+CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t)) ENGINE = InnoDB;
+SET NAMES latin1;
+INSERT INTO t1 VALUES('Mit freundlichem Gr�� aus Osnabr�ck');
+SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr�ck"' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#
+# BUG#11684 - repair crashes mysql when table has fulltext index
+#
+
+CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+
+# INNODB_FTS: InnoDB do not support repair
+#SET myisam_repair_threads=2;
+#REPAIR TABLE t1;
+#SET myisam_repair_threads=@@global.myisam_repair_threads;
+
+#
+# BUG#5686 - #1034 - Incorrect key file for table - only utf8
+#
+INSERT INTO t1 VALUES('testword\'\'');
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
+
+#
+# BUG#14194: Problem with fulltext boolean search and apostrophe
+#
+# INNODB_FTS: Add "apostrophe" support
+INSERT INTO t1 VALUES('test\'s');
+SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#
+# BUG#13835: max key length is 1000 bytes when trying to create
+#            a fulltext index
+#
+CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a)) ENGINE = InnoDB;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# BUG#14496: Crash or strange results with prepared statement,
+#            MATCH and FULLTEXT
+#
+CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('test'),('test1'),('test');
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+#
+# BUG#25951 - ignore/use index does not work with fulltext
+#
+CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a)) ENGINE = InnoDB;
+SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test');
+# INNODB_FTS: InnoDB do have have this option (disable keys)
+# ALTER TABLE t1 DISABLE KEYS;
+# --error 1191
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('test');
+DROP TABLE t1;
+
+#
+# BUG#11392 - fulltext search bug
+#
+CREATE TABLE t1(a TEXT, fulltext(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(' aaaaa aaaa');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#
+# BUG#29445 - match ... against () never returns
+#
+CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('Offside'),('City Of God');
+
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE);
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city (of*)' IN BOOLEAN MODE);
+SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+# End of 4.1 tests
+
+#
+# bug#34374 - mysql generates incorrect warning
+#
+create table t1(a text,b date,fulltext index(a)) ENGINE = InnoDB;
+insert into t1 set a='water',b='2008-08-04';
+select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01';
+drop table t1;
+show warnings;
+
+#
+# BUG#38842 - Fix for 25951 seems incorrect
+#
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+                     ('test', 1),('test', 2),('test', 3),('test', 4);
+
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+DROP TABLE t1;
+
+#
+# BUG#37245 - Full text search problem
+#
+CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('aaa15');
+
+SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
+SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
+DROP TABLE t1;
+
+#
+# BUG#36737 - having + full text operator crashes mysql
+#
+CREATE TABLE t1(a TEXT) ENGINE = InnoDB;
+--error ER_WRONG_ARGUMENTS
+SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#
+# BUG#42907 - Multi-term boolean fulltext query containing a single
+#             quote fails in 5.1.x
+#
+CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#
+# BUG#37740 Server crashes on execute statement with full text search and match against
+#
+CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col)) ENGINE = InnoDB;
+
+PREPARE s FROM 
+  "SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
+  ;
+
+EXECUTE s;
+DEALLOCATE PREPARE s;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #49250 : spatial btree index corruption and crash
+--echo # Part two : fulltext syntax check
+--echo #
+
+--error ER_PARSE_ERROR
+CREATE TABLE t1(col1 TEXT,
+  FULLTEXT INDEX USING BTREE (col1));
+CREATE TABLE t2(col1 TEXT) ENGINE = InnoDB;
+--error ER_PARSE_ERROR
+CREATE FULLTEXT INDEX USING BTREE ON t2(col);
+--error ER_PARSE_ERROR
+ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
+
+DROP TABLE t2;
+
+
+--echo End of 5.0 tests
+
+
+--echo #
+--echo # Bug #47930: MATCH IN BOOLEAN MODE returns too many results 
+--echo #  inside subquery
+--echo #
+
+CREATE TABLE t1 (a int) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+
+CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1,'Scargill');
+
+CREATE TABLE t3 (a int, b int) ENGINE = InnoDB;
+INSERT INTO t3 VALUES (1,1), (2,1);
+
+--echo # t2 should use full text index
+EXPLAIN
+SELECT count(*) FROM t1 WHERE 
+  not exists(
+   SELECT 1 FROM t2, t3
+   WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+  );
+
+# INNODB_FTS: INVESTIGATE
+--echo # should return 0
+SELECT count(*) FROM t1 WHERE 
+  not exists(
+   SELECT 1 FROM t2, t3
+   WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+  );
+
+--echo # should return 0
+SELECT count(*) FROM t1 WHERE 
+  not exists(
+   SELECT 1 FROM t2 IGNORE INDEX (b2), t3
+   WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
+  );
+
+DROP TABLE t1,t2,t3;
+
+#
+# BUG#50351 - ft_min_word_len=2 Causes query to hang
+#
+CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
+('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
+('awrd');
+SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo #
+--echo # Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with 
+--echo #   fulltext search and row op
+--echo #
+
+CREATE TABLE t1(a CHAR(1),FULLTEXT(a)) ENGINE = InnoDB;
+SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
+DROP TABLE t1;
+
+--echo #
+--echo # BUG#51866 - crash with repair by sort and fulltext keys
+--echo #
+CREATE TABLE t1(a CHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('aaaa');
+# INNODB_FTS: Do not support "set myisam_sort_buffer" commands
+#SET myisam_sort_buffer_size=4;
+#REPAIR TABLE t1;
+#SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+--echo #
+
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('test');
+--disable_warnings
+SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+--enable_warnings
+
+DROP TABLE t1;
+
+--echo End of 5.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext2.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext2.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext2.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,235 @@
+#
+# test of new fulltext search features
+#
+
+#
+# two-level tree
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+  i int(10) unsigned not null auto_increment primary key,
+  a varchar(255) not null,
+  FULLTEXT KEY (a)
+) ENGINE = INNODB;
+
+# two-level entry, second-level tree with depth 2
+--disable_query_log
+let $1=260;
+while ($1)
+{
+  eval insert t1 (a) values ('aaaxxx');
+  dec $1;
+}
+
+# two-level entry, second-level tree has only one page
+let $1=255;
+while ($1)
+{
+  eval insert t1 (a) values ('aaazzz');
+  dec $1;
+}
+
+# one-level entry (entries)
+let $1=250;
+while ($1)
+{
+  eval insert t1 (a) values ('aaayyy');
+  dec $1;
+}
+--enable_query_log
+
+# converting to two-level
+# INNODB_FTS: Do not support repair
+#repair table t1 quick;
+check table t1;
+#optimize table t1; # BUG#5327 - mi_sort_index() of 2-level tree
+#check table t1;
+
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+
+# mi_write:
+
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+# call to enlarge_root() below
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+
+# mi_delete
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx');
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+# double-check without index
+select count(*) from t1 where a = 'aaaxxx';
+select count(*) from t1 where a = 'aaayyy';
+select count(*) from t1 where a = 'aaazzz';
+
+# update
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+
+drop table t1;
+
+CREATE TABLE t1 (
+  i int(10) unsigned not null auto_increment primary key,
+  a varchar(255) not null,
+  FULLTEXT KEY (a)
+) ENGINE = INNODB;
+
+#
+# now same as about but w/o repair table
+# 2-level tree created by mi_write
+#
+
+# two-level entry, second-level tree with depth 2
+--disable_query_log
+let $1=260;
+while ($1)
+{
+  eval insert t1 (a) values ('aaaxxx');
+  dec $1;
+}
+let $1=255;
+while ($1)
+{
+  eval insert t1 (a) values ('aaazzz');
+  dec $1;
+}
+let $1=250;
+while ($1)
+{
+  eval insert t1 (a) values ('aaayyy');
+  dec $1;
+}
+--enable_query_log
+
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+
+# mi_write:
+
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+
+# mi_delete
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx');
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+# double-check without index
+select count(*) from t1 where a = 'aaaxxx';
+select count(*) from t1 where a = 'aaayyy';
+select count(*) from t1 where a = 'aaazzz';
+
+# update
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+drop table t1;
+
+#
+# BUG#11336
+#
+# for uca collation isalnum and strnncollsp don't agree on whether
+# 0xC2A0 is a space (strnncollsp is right, isalnum is wrong).
+#
+# they still don't, the bug was fixed by avoiding strnncollsp
+#
+
+set names utf8;
+eval create table t1(a text,fulltext(a)) ENGINE = INNODB collate=utf8_swedish_ci;
+insert into t1 values('test test��'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
+('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
+delete from t1 limit 1;
+
+#
+# BUG#16489: utf8 + fulltext leads to corrupt index file.
+#
+truncate table t1;
+insert into t1 values('ab��c d');
+update t1 set a='ab c d';
+select * from t1 where match a against('ab c' in boolean mode);
+select * from t1 where match a against('ab	c' in boolean mode);
+drop table t1;
+set names latin1;
+
+# End of 4.1 tests
+
+#
+# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns
+# INNODB_FTS: Investigate
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE = INNODB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('���MySQL���');
+SELECT a FROM t1 WHERE MATCH a AGAINST('���MySQL���' IN BOOLEAN MODE);
+DROP TABLE t1;
+SET NAMES latin1;

=== added file 'mysql-test/suite/innodb_fts/t/fulltext3.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext3.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext3.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,36 @@
+--source include/have_gbk.inc
+#
+# test of new fulltext search features
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $default_engine = `select @@SESSION.default_storage_engine`;
+#
+# BUG#29299 - repeatable myisam fulltext index corruption
+#
+# INNODB_FTS: Not yet support gbk charset
+CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a)) ENGINE = InnoDB;
+SET NAMES utf8;
+# INSERT INTO t1 VALUES(0xF043616161),(0xBEF361616197C22061616161);
+# SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST(0x97C22061616161 IN BOOLEAN MODE);
+DELETE FROM t1 LIMIT 1;
+#CHECK TABLE t1;
+SET NAMES latin1;
+DROP TABLE t1;
+
+# End of 5.0 tests
+
+#
+# BUG#29464 - load data infile into table with big5 chinese fulltext index
+#             hangs 100% cpu
+#
+--replace_result $default_engine <default_engine>
+EVAL CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
+FULLTEXT(a)) ENGINE=$default_engine;
+# INSERT INTO t1 VALUES(0xA3C2);
+DROP TABLE t1;
+
+# End of 5.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_cache.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_cache.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_cache.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,54 @@
+#
+# Bugreport due to Roy Nasser <roy at vem.ca>
+#
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+  id int(10) unsigned NOT NULL auto_increment,
+  q varchar(255) default NULL,
+  PRIMARY KEY (id)
+) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES (1,'aaaaaaaaa dsaass de');
+INSERT INTO t1 VALUES (2,'ssde df s fsda sad er');
+
+CREATE TABLE t2 (
+  id int(10) unsigned NOT NULL auto_increment,
+  id2 int(10) unsigned default NULL,
+  item varchar(255) default NULL,
+  PRIMARY KEY (id),
+  FULLTEXT KEY item(item)
+) ENGINE = InnoDB;
+
+INSERT INTO t2 VALUES (1,1,'sushi');
+INSERT INTO t2 VALUES (2,1,'Bolo de Chocolate');
+INSERT INTO t2 VALUES (3,1,'Feijoada');
+INSERT INTO t2 VALUES (4,1,'Mousse de Chocolate');
+INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
+INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
+INSERT INTO t2 VALUES (7,1,'Bife');
+INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
+
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
+as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+
+SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
+as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
+as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+
+SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
+as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
+
+drop table t1, t2;
+
+# End of 4.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_distinct.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_distinct.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_distinct.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,47 @@
+#
+# Test of fulltext index
+# bug reported by  Tibor Simko <tibor.simko at cern.ch>
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ id mediumint unsigned NOT NULL auto_increment,
+ tag char(6) NOT NULL default '',
+ value text NOT NULL default '',
+ PRIMARY KEY (id),
+ KEY kt(tag),
+ KEY kv(value(15)),
+ FULLTEXT KEY kvf(value)
+) ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+ id_t2 mediumint unsigned NOT NULL default '0',
+ id_t1 mediumint unsigned NOT NULL default '0',
+ field_number tinyint unsigned NOT NULL default '0',
+ PRIMARY KEY (id_t2,id_t1,field_number),
+ KEY id_t1(id_t1)
+) ENGINE = InnoDB;
+
+INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
+INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
+INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar');
+
+INSERT INTO t2 VALUES (2231626,64280,0);
+INSERT INTO t2 VALUES (2231626,64281,0);
+INSERT INTO t2 VALUES (12346, 3, 1);
+
+SELECT * FROM t1; SELECT * FROM t2;
+
+SELECT DISTINCT t2.id_t2 FROM t2, t1
+WHERE MATCH (t1.value) AGAINST ('baz333') AND t1.id = t2.id_t1;
+
+SELECT DISTINCT t2.id_t2 FROM t2, t1
+WHERE MATCH (t1.value) AGAINST ('baz333' IN BOOLEAN MODE)
+AND t1.id = t2.id_t1;
+
+DROP TABLE t1, t2;
+
+# End of 4.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_left_join.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_left_join.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_left_join.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,130 @@
+#
+# Test for bug from Jean-C�dric COSTA <jean-cedric.costa at ensmp.fr>
+#
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+       id           VARCHAR(255) NOT NULL PRIMARY KEY,
+       sujet        VARCHAR(255),
+       motsclefs    TEXT,
+       texte        MEDIUMTEXT,
+       FULLTEXT(sujet, motsclefs, texte)
+) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES('123','toto','essai','test');
+INSERT INTO t1 VALUES('456','droit','penal','lawyer');
+INSERT INTO t1 VALUES('789','aaaaa','bbbbb','cccccc');
+
+CREATE TABLE t2 (
+       id         VARCHAR(255) NOT NULL,
+       author     VARCHAR(255) NOT NULL
+) ENGINE = InnoDB;
+
+INSERT INTO t2 VALUES('123', 'moi');
+INSERT INTO t2 VALUES('123', 'lui');
+INSERT INTO t2 VALUES('456', 'lui');
+
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+       from t1 left join t2 on t2.id=t1.id;
+select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
+       from t1 left join t2 on t2.id=t1.id;
+
+drop table t1, t2;
+
+#
+# BUG#484, reported by Stephen Brandon <stephen at brandonitconsulting.co.uk>
+#
+
+create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) ENGINE = InnoDB;
+ 
+insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00');
+eval create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key  (entity_id), fulltext key name (name)) engine= innodb;
+insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
+select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
+select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
+select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
+drop table t1,t2;
+
+#
+# BUG#14708
+# Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index
+#
+
+create table t1 (id int not null primary key, d char(200) not null, e char(200), fulltext (d, e)) ENGINE = InnoDB;
+insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null);
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+select * from t1 where match(d, e) against ('+aword +bword' in boolean mode);
+
+# INNODB_FTS: Investigate Full Text search on joined result
+create table t2 (m_id int not null, f char(200), key (m_id), fulltext (f)) engine = InnoDB;
+insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
+-- disable_result_log
+ANALYZE TABLE t2;
+-- enable_result_log
+select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
+drop table t1,t2;
+
+#
+# BUG#25637: LEFT JOIN with BOOLEAN FULLTEXT loses left table matches
+#            (this is actually the same bug as bug #14708)
+#
+
+CREATE TABLE t1 (
+  id int(10) NOT NULL auto_increment,
+  link int(10) default NULL,
+  name mediumtext default NULL,
+  PRIMARY KEY (id),
+  FULLTEXT (name)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1, 1, 'string');
+INSERT INTO t1 VALUES (2, 0, 'string');
+CREATE TABLE t2 (
+    id int(10) NOT NULL auto_increment,
+    name mediumtext default NULL,
+    PRIMARY KEY (id),
+    FULLTEXT (name)
+) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1, 'string');
+
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+
+SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance 
+  FROM t1 LEFT JOIN t2 ON t1.link = t2.id
+    WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
+
+DROP TABLE t1,t2;
+
+# End of 4.1 tests
+
+#
+# BUG#25729 - boolean full text search is confused by NULLs produced by LEFT
+#             JOIN
+#
+CREATE TABLE t1 (a INT) ENGINE = InnoDB;
+CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+DROP TABLE t1, t2;

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_misc.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_misc.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_misc.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,213 @@
+#
+# Fulltext configurable parameters
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--echo #
+--echo # Bug#56814 Explain + subselect + fulltext crashes server
+--echo #
+
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,FULLTEXT KEY(f1),UNIQUE(f1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('test');
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1;
+
+#try to crash gcc 2.96
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+  kodoboru varchar(10) default NULL,
+  obor tinytext,
+  aobor tinytext,
+  UNIQUE INDEX kodoboru (kodoboru),
+  FULLTEXT KEY obor (obor),
+  FULLTEXT KEY aobor (aobor)
+) ENGINE = InnoDB;
+
+drop table t1;
+
+CREATE TABLE t1 (
+  kodoboru varchar(10) default NULL,
+  obor tinytext,
+  aobor tinytext,
+  UNIQUE INDEX kodoboru (kodoboru),
+  FULLTEXT KEY obor (obor)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('0101000000','aaa','AAA');
+INSERT INTO t1 VALUES ('0102000000','bbb','BBB');
+INSERT INTO t1 VALUES ('0103000000','ccc','CCC');
+INSERT INTO t1 VALUES ('0104000000','xxx','XXX');
+
+select * from t1;
+drop table t1;
+
+# End of 4.1 tests
+
+
+#
+# Bug#20503: Server crash due to the ORDER clause isn't taken into account
+#            while space allocation
+#
+create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
+c7 int, c8 int, c9 int, fulltext key (`c1`)) ENGINE = InnoDB;
+select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8
+  from t1 where c9=1 order by c2, c2;
+drop table t1;
+
+
+#
+# VIEW with full text
+#
+CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2)) ENGINE = InnoDB;
+insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer');
+select * from t1 WHERE match (c2) against ('Beer');
+CREATE VIEW v1 AS SELECT  * from t1 WHERE match (c2) against ('Beer');
+select * from v1;
+drop view v1;
+drop table t1;
+
+
+# Test case for bug 6447
+create table t1 (mytext text, FULLTEXT (mytext)) ENGINE = InnoDB;
+insert t1 values ('aaabbb');
+
+# INNODB_FTS: These variables are not support in InnoDB
+check table t1;
+# set @my_key_cache_block_size= @@global.key_cache_block_size;
+# set GLOBAL key_cache_block_size=2048;
+check table t1;
+drop table t1;
+# Restore the changed variable value
+#set global key_cache_block_size= @my_key_cache_block_size;
+
+
+
+#
+# BUG#12075 - FULLTEXT non-functional for big5 strings
+# 
+# INNODB_FTS: Not yet support big5
+#CREATE TABLE t1 (a CHAR(50) CHARACTER SET big5 NOT NULL, FULLTEXT(a)) ENGINE = InnoDB;
+#INSERT INTO t1 VALUES(0xA741ADCCA66EB6DC20A7DAADCCABDCA66E);
+#SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST (0xA741ADCCA66EB6DC IN BOOLEAN MODE);
+#DROP TABLE t1;
+
+#
+
+create table t1 (a varchar(10), fulltext key(a)) ENGINE = InnoDB;
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+create table t2 ENGINE = InnoDB as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+drop table t1, t2;
+
+
+#
+# BUG#31159 - fulltext search on ucs2 column crashes server
+#
+CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB;
+INSERT INTO t1 VALUES('abcd');
+
+# INNODB_FTS: Please Note this table do not have FTS. InnoDB return 1214 error
+--error ER_TABLE_HAS_NO_FT
+SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+
+#
+# Some other simple tests with the current character set
+#
+create table t1 (a varchar(10), key(a), fulltext (a)) ENGINE = InnoDB;
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+select * from t1 where a like "abc%";
+select * from t1 where a like "test%";
+select * from t1 where a like "te_t";
+# InnoDB_FTS: we don't support the postfix "+0"
+select * from t1 where match a against ("te*" in boolean mode)+0;
+drop table t1;
+
+
+
+--echo # 
+--echo # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY 
+--echo #   <any non-const-function>
+--echo # 
+
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE = InnoDB;
+INSERT INTO t2 VALUES (1),(2);
+
+--echo # Should not crash
+EXPLAIN EXTENDED
+SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
+
+--echo # Should not crash
+SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
+
+
+--echo # Should not crash
+--error ER_CANT_USE_OPTION_HERE
+EXPLAIN EXTENDED
+SELECT * FROM t1 UNION SELECT * FROM t1
+  ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
+
+--echo # Should not crash
+--error ER_CANT_USE_OPTION_HERE
+SELECT * FROM t1 UNION SELECT * FROM t1
+  ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
+
+# FIXME: Valgrind in MySQL code _MI_WRITE_BLOB_RECORD, bug #13389854
+#--echo # Should not crash
+#(SELECT * FROM t1) UNION (SELECT * FROM t1)
+#  ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
+
+
+--echo # Should not crash
+EXPLAIN EXTENDED
+SELECT * FROM t1 UNION SELECT * FROM t1
+  ORDER BY (SELECT a FROM t2 WHERE b = 12);
+
+--echo # Should not crash
+--disable_result_log
+SELECT * FROM t1 UNION SELECT * FROM t1
+  ORDER BY (SELECT a FROM t2 WHERE b = 12);
+--enable_result_log
+
+--echo # Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+  ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+
+DROP TABLE t1,t2;
+
+
+--echo End of 5.1 tests
+

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_multi.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_multi.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_multi.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,39 @@
+# several FULLTEXT indexes in one table test
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+  a int(11) NOT NULL auto_increment,
+  b text,
+  c varchar(254) default NULL,
+  PRIMARY KEY (a),
+  FULLTEXT KEY bb(b),
+  FULLTEXT KEY cc(c),
+  FULLTEXT KEY a(b,c)
+) ENGINE = InnoDB;
+
+drop table t1;
+
+CREATE TABLE t1 (
+  a int(11) NOT NULL auto_increment,
+  b text,
+  c varchar(254) default NULL,
+  PRIMARY KEY (a),
+  FULLTEXT KEY a(b,c)
+) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
+INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
+INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
+
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+
+SELECT a, round(MATCH  b,c AGAINST ('lala lkjh'),5) FROM t1;
+SELECT a, round(MATCH  c,c AGAINST ('lala lkjh'),5) FROM t1;
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
+drop table t1;
+
+# End of 4.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_order_by.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_order_by.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_order_by.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,165 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+--enable_warnings
+
+CREATE TABLE t1 (
+  a INT AUTO_INCREMENT PRIMARY KEY,
+  message CHAR(20),
+  FULLTEXT(message)
+) ENGINE = InnoDB comment = 'original testcase by sroussey at network54.com';
+INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
+        ("steve"),("is"),("cool"),("steve is cool");
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+# basic MATCH
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+
+# MATCH + ORDER BY (with ft-ranges)
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
+
+# MATCH + ORDER BY (with normal ranges) + UNIQUE
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
+
+# MATCH + ORDER BY + UNIQUE (const_table)
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
+
+# ORDER BY MATCH
+# INNODB_FTS: INVESITGATE
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
+SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
+
+#
+# BUG#6635 - test_if_skip_sort_order() thought it can skip filesort
+# for fulltext searches too
+#
+alter table t1 add key m (message);
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message;
+SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc;
+
+drop table t1;
+
+#
+# reused boolean scan bug
+#
+CREATE TABLE t1 (
+  a INT AUTO_INCREMENT PRIMARY KEY,
+  message CHAR(20),
+  FULLTEXT(message)
+) ENGINE = InnoDB;
+INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
+SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
+drop table t1;
+
+# BUG#11869
+CREATE TABLE t1 (
+  id int(11) NOT NULL auto_increment,
+  thread int(11) NOT NULL default '0',
+  beitrag longtext NOT NULL,
+  PRIMARY KEY  (id),
+  KEY thread (thread),
+  FULLTEXT KEY beitrag (beitrag)
+) ENGINE =InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7923 ;
+
+CREATE TABLE t2 (
+  id int(11) NOT NULL auto_increment,
+  text varchar(100) NOT NULL default '',
+  PRIMARY KEY  (id),
+  KEY text (text)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ;
+
+CREATE TABLE t3 (
+  id int(11) NOT NULL auto_increment,
+  forum int(11) NOT NULL default '0',
+  betreff varchar(70) NOT NULL default '',
+  PRIMARY KEY  (id),
+  KEY forum (forum),
+  FULLTEXT KEY betreff (betreff)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ;
+
+--error ER_CANT_USE_OPTION_HERE
+select a.text, b.id, b.betreff
+from 
+  t2 a inner join t3 b on a.id = b.forum inner join
+  t1 c on b.id = c.thread
+where 
+  match(b.betreff) against ('+abc' in boolean mode)
+group by a.text, b.id, b.betreff
+union
+select a.text, b.id, b.betreff
+from 
+  t2 a inner join t3 b on a.id = b.forum inner join
+  t1 c on b.id = c.thread
+where 
+  match(c.beitrag) against ('+abc' in boolean mode)
+group by 
+  a.text, b.id, b.betreff
+order by 
+  match(b.betreff) against ('+abc' in boolean mode) desc;
+  
+--error ER_CANT_USE_OPTION_HERE
+select a.text, b.id, b.betreff
+from 
+  t2 a inner join t3 b on a.id = b.forum inner join
+  t1 c on b.id = c.thread
+where 
+  match(b.betreff) against ('+abc' in boolean mode)
+union
+select a.text, b.id, b.betreff
+from 
+  t2 a inner join t3 b on a.id = b.forum inner join
+  t1 c on b.id = c.thread
+where 
+  match(c.beitrag) against ('+abc' in boolean mode)
+order by 
+  match(b.betreff) against ('+abc' in boolean mode) desc;
+
+--error ER_CANT_USE_OPTION_HERE
+select a.text, b.id, b.betreff
+from 
+  t2 a inner join t3 b on a.id = b.forum inner join
+  t1 c on b.id = c.thread
+where 
+  match(b.betreff) against ('+abc' in boolean mode)
+union
+select a.text, b.id, b.betreff
+from 
+  t2 a inner join t3 b on a.id = b.forum inner join
+  t1 c on b.id = c.thread
+where 
+  match(c.beitrag) against ('+abc' in boolean mode)
+order by 
+  match(betreff) against ('+abc' in boolean mode) desc;
+
+# BUG#11869 part2: used table type doesn't support FULLTEXT indexes error
+(select b.id, b.betreff from t3 b) union 
+(select b.id, b.betreff from t3 b) 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+
+--error 1191
+(select b.id, b.betreff from t3 b) union 
+(select b.id, b.betreff from t3 b) 
+order by match(betreff) against ('+abc') desc;
+
+select distinct b.id, b.betreff from t3 b 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+
+select b.id, b.betreff from t3 b group by b.id+1 
+order by match(betreff) against ('+abc' in boolean mode) desc;
+
+drop table t1,t2,t3;
+
+# End of 4.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_plugin-master.opt'
--- a/mysql-test/suite/innodb_fts/t/fulltext_plugin-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_plugin-master.opt	2013-08-07 09:55:00 +0000
@@ -0,0 +1 @@
+$SIMPLE_PARSER_OPT

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_update.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_update.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_update.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,33 @@
+#
+# Test for bug by voi at ims.at
+#
+
+--disable_warnings
+drop table if exists test;
+--enable_warnings
+
+let $default_engine = `select @@SESSION.default_storage_engine`;
+# --replace_result $default_engine <default_engine>
+CREATE TABLE test (
+  gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+  url VARCHAR(80) DEFAULT '' NOT NULL,
+  shortdesc VARCHAR(200) DEFAULT '' NOT NULL,
+  longdesc text DEFAULT '' NOT NULL,
+  description VARCHAR(80) DEFAULT '' NOT NULL,
+  name VARCHAR(80) DEFAULT '' NOT NULL,
+  FULLTEXT(url,description,shortdesc,longdesc),
+  PRIMARY KEY(gnr)
+) ENGINE = InnoDB;
+
+insert into test (url,shortdesc,longdesc,description,name) VALUES 
+("http:/test.at", "kurz", "lang","desc", "name");
+insert into test (url,shortdesc,longdesc,description,name) VALUES 
+("http:/test.at", "kurz", "","desc", "name");
+update test set url='test', description='ddd', name='nam' where gnr=2;
+update test set url='test', shortdesc='ggg', longdesc='mmm', 
+description='ddd', name='nam' where gnr=2;
+
+check table test;
+drop table test;
+
+# End of 4.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/fulltext_var.test'
--- a/mysql-test/suite/innodb_fts/t/fulltext_var.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/fulltext_var.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,40 @@
+#
+# Fulltext configurable parameters
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+
+# Save ft_boolean_syntax variable
+let $saved_ft_boolean_syntax=`select @@global.ft_boolean_syntax`;
+
+show variables like "ft\_%";
+
+# INNODB_FTS: Please note original table do not have fulltext index.
+# InnoDB will return 1214. I added "fulltext(b)" to the create table statement
+# In addition, we do not support MyISAM configure parameter
+create table t1 (b text not null, fulltext(b)) engine = innodb;
+insert t1 values ('aaaaaa bbbbbb cccccc');
+insert t1 values ('bbbbbb cccccc');
+insert t1 values ('aaaaaa cccccc');
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+-- error 1229
+set ft_boolean_syntax=' +-><()~*:""&|';
+set global ft_boolean_syntax=' +-><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+set global ft_boolean_syntax='@ -><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
+-- error 1231
+set global ft_boolean_syntax='@ -><()~*:""@|';
+-- error 1231
+set global ft_boolean_syntax='+ -><()~*:""@!|';
+drop table t1;
+
+# Restore ft_boolean_syntax variable
+--disable_query_log
+eval set global ft_boolean_syntax='$saved_ft_boolean_syntax';
+--enable_query_log
+
+# End of 4.1 tests

=== added file 'mysql-test/suite/innodb_fts/t/innobase_drop_fts_index_table.test'
--- a/mysql-test/suite/innodb_fts/t/innobase_drop_fts_index_table.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innobase_drop_fts_index_table.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,19 @@
+#
+# Test innobase_drop_fts_index_table()
+#
+
+-- source include/have_innodb.inc
+# Must have debug code to use SET SESSION debug
+-- source include/have_debug.inc
+-- source include/not_embedded.inc
+
+CREATE TABLE t (a INT, b TEXT);
+
+SET DEBUG='+d,alter_table_rollback_new_index';
+
+-- error ER_UNKNOWN_ERROR
+ALTER TABLE t ADD FULLTEXT INDEX (b(64));
+
+SET DEBUG='-d,alter_table_rollback_new_index';
+
+DROP TABLE t;

=== added file 'mysql-test/suite/innodb_fts/t/innodb-fts-basic.test'
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-basic.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,213 @@
+# This is the basic function tests for innodb FTS
+
+-- source include/have_innodb.inc
+
+# Create FTS table
+CREATE TABLE articles (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	title VARCHAR(200),
+	body TEXT,
+	FULLTEXT (title,body)
+	) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+-- disable_result_log
+ANALYZE TABLE articles;
+-- enable_result_log
+
+# Look for 'Database' in table article
+SELECT * FROM articles
+	WHERE MATCH (title,body)
+	AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+SELECT COUNT(*) FROM articles
+	WHERE MATCH (title,body)
+	AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+     WHERE MATCH (title, body)
+     AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+
+SELECT COUNT(IF(MATCH (title,body)
+	AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+	AS count FROM articles;
+
+# Select Relevance Ranking
+SELECT id,  body, MATCH (title,body)
+	AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
+	FROM articles;
+
+# 'MySQL' treated as stopword (stopword functionality not yet supported)
+SELECT * FROM articles
+	WHERE MATCH (title,body)
+	AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+# Boolean search
+# Select rows contain "MySQL" but not "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+
+# Select rows contain at least one of the two words
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('DBMS Security' IN BOOLEAN MODE);
+
+# Select rows contain both "MySQL" and "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+
+# Select rows contain "MySQL" but rank rows with "YourSQL" higher
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
+
+# Test negation operator. Select rows contain MySQL,
+# if the row contains "YourSQL", rank it lower
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
+
+# Test wild card search operator
+# Notice row with "the" will not get fetched due to
+# stopword filtering
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('t*' IN BOOLEAN MODE);
+
+# Test wild card search, notice row 6 with 2 "MySQL" rank first
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('MY*' IN BOOLEAN MODE);
+
+# Another wild card search
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('ru*' IN BOOLEAN MODE);
+
+# Test ">" and "<" Operator, the ">" operator increases
+# the word relevance rank and the "<" operator decreases it
+# Following test puts rows with "Well" on top and rows
+# with "stands" at the bottom
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
+
+# Test sub-expression boolean search. Find rows contain
+# "MySQL" but not "Well" or "stands".
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+
+# Test sub-expression boolean search. Find rows contain
+# "MySQL" and "Well" or "MySQL" and "stands". But rank the 
+# doc with "Well" higher, and doc with "stands" lower.
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
+
+# Test nested sub-expression.
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
+
+# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+	AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
+
+# Test query expansion
+SELECT COUNT(*) FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('database' WITH QUERY EXPANSION);
+
+INSERT INTO articles (title,body) VALUES
+	('test query expansion','for database ...');
+
+# This query will return result containing word "database" as
+# the query expand from "test" to words in document just
+# inserted above
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('test' WITH QUERY EXPANSION);
+
+# This is to test the proximity search, search two word
+# "following" and "comparison" within 19 character space
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
+
+# This is to test the proximity search, search two word
+# "following" and "comparison" within 19 character space
+# This search should come with no return result
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
+
+# This is to test the phrase search, searching phrase
+# "following database"
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('"following database"' IN BOOLEAN MODE);
+
+# Insert into table with similar word of different distances
+INSERT INTO articles (title,body) VALUES
+	('test proximity search, test, proximity and phrase',
+	 'search, with proximity innodb');
+
+INSERT INTO articles (title,body) VALUES
+	('test my proximity fts new search, test, proximity and phrase',
+	 'search, with proximity innodb');
+
+INSERT INTO articles (title,body) VALUES
+	('test more of proximity fts search, test, more proximity and phrase',
+	 'search, with proximity innodb');
+
+# This should only return the first document
+SELECT * FROM articles
+	WHERE MATCH (title,body)
+	AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT * FROM articles
+	WHERE MATCH (title,body)
+	AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT * FROM articles
+	WHERE MATCH (title,body)
+	AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
+
+# Similar boundary testing for the words
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+
+# No document will be returned
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
+
+# All three documents will be returned
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+
+# Only two document will be returned.
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+	AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+
+drop table articles;

=== added file 'mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test'
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,272 @@
+# This is the DDL function tests for innodb FTS
+
+-- source include/have_innodb.inc
+
+# Create FTS table
+CREATE TABLE fts_test (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO fts_test (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+# Create the FTS index
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+
+# Select word "tutorial" in the table
+SELECT * FROM fts_test WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+
+# Drop the FTS idx
+DROP INDEX idx ON fts_test;
+
+# Continue insert some rows
+INSERT INTO fts_test (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+
+# Recreate the FTS index
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+
+# Select word "tutorial" in the table
+SELECT * FROM fts_test WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# Boolean search
+# Select rows contain "MySQL" but not "YourSQL"
+SELECT * FROM fts_test WHERE MATCH (title,body)
+        AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+
+# Truncate table
+TRUNCATE TABLE fts_test;
+
+DROP INDEX idx ON fts_test;
+
+# Continue insert some rows
+INSERT INTO fts_test (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+# Recreate the FTS index
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+
+# Select word "tutorial" in the table
+SELECT * FROM fts_test WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE fts_test;
+
+# Create FTS table
+CREATE TABLE fts_test (
+	FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+create unique index FTS_DOC_ID_INDEX on fts_test(FTS_DOC_ID);
+
+# Insert six rows
+INSERT INTO fts_test (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+# Create the FTS index
+# We could support online fulltext index creation when a FTS_DOC_ID
+# column already exists. This has not been implemented yet.
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
+ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
+
+SELECT * FROM fts_test WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# Drop and recreate
+drop index idx on fts_test;
+
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+
+SELECT * FROM fts_test WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# Drop the FTS_DOC_ID_INDEX and try again
+drop index idx on fts_test;
+
+drop index FTS_DOC_ID_INDEX on fts_test;
+
+CREATE FULLTEXT INDEX idx on fts_test (title, body);
+
+SELECT * FROM fts_test WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+drop table fts_test;
+
+# Test FTS_DOC_ID and FTS_DOC_ID_INDEX all in the create table clause
+CREATE TABLE fts_test (
+   FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+   title varchar(255) NOT NULL DEFAULT '',
+   text mediumtext NOT NULL,
+   PRIMARY KEY (FTS_DOC_ID),
+   UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+   FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+set @@auto_increment_increment=10;
+
+INSERT INTO fts_test (title, text) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...'),
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+-- disable_result_log
+ANALYZE TABLE fts_test;
+-- enable_result_log
+set @@auto_increment_increment=1;
+
+select *, match(title, text)  AGAINST ('database') as score
+from fts_test order by score desc;
+
+drop index idx on fts_test;
+
+drop table fts_test;
+
+# This should fail:
+# Create a FTS_DOC_ID of the wrong type (should be bigint)
+--error 1166
+CREATE TABLE fts_test (
+   FTS_DOC_ID int(20) unsigned NOT NULL AUTO_INCREMENT,
+   title varchar(255) NOT NULL DEFAULT '',
+   text mediumtext NOT NULL,
+   PRIMARY KEY (FTS_DOC_ID),
+   UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+   FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+# This should fail:
+# Create a FTS_DOC_ID_INDEX of the wrong type (should be unique)
+--error ER_INNODB_FT_WRONG_DOCID_INDEX
+CREATE TABLE fts_test (
+   FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+   title varchar(255) NOT NULL DEFAULT '',
+   text mediumtext NOT NULL,
+   PRIMARY KEY (FTS_DOC_ID),
+   KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+   FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+CREATE TABLE articles (
+	FTS_DOC_ID BIGINT UNSIGNED NOT NULL ,
+	title VARCHAR(200),
+	body TEXT
+) ENGINE=InnoDB;
+
+INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
+        (9, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+        (10, 'How To Use MySQL Well','After you went through a ...'),
+        (12, 'Optimizing MySQL','In this tutorial we will show ...'),
+        (14,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        (19, 'MySQL vs. YourSQL','In the following database comparison ...'),
+        (20, 'MySQL Security','When configured properly, MySQL ...');
+
+--error ER_INNODB_FT_LIMIT
+ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title),
+		     ADD FULLTEXT INDEX idx5 (title);
+
+CREATE FULLTEXT INDEX idx on articles (title);
+ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title);
+
+ALTER TABLE articles ADD INDEX t20 (title(20)), LOCK=NONE;
+ALTER TABLE articles DROP INDEX t20;
+
+INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
+        (29, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+        (30, 'How To Use MySQL Well','After you went through a ...'),
+        (32, 'Optimizing MySQL','In this tutorial we will show ...'),
+        (34,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        (39, 'MySQL vs. YourSQL','In the following database comparison ...'),
+        (40, 'MySQL Security','When configured properly, MySQL ...');
+
+SELECT * FROM articles WHERE MATCH (title)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP INDEX idx ON articles;
+
+SELECT * FROM articles WHERE MATCH (title)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+SELECT * FROM articles WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+create table articles(`FTS_DOC_ID` serial,
+`col32` timestamp not null,`col115` text) engine=innodb;
+
+create fulltext index `idx5` on articles(`col115`)  ;
+
+alter ignore table articles add primary key  (`col32`)  ;
+
+drop table articles;
+
+# Create a table with FTS index, this will create hidden column FTS_DOC_ID
+CREATE TABLE articles (
+	id INT UNSIGNED NOT NULL,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+INSERT INTO articles VALUES
+	(1, 'MySQL Tutorial','DBMS stands for 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','1. Never run mysqld as root. 2. ...'),
+	(5, 'MySQL vs. YourSQL','In the following database comparison ...'),
+	(6, 'MySQL Security','When configured properly, MySQL ...');
+
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+# Drop the FTS index, however, this will keep the FTS_DOC_ID hidden
+# column (to avoid a table rebuild)
+DROP INDEX idx ON articles;
+
+# Now create cluster index on id online; The rebuild should still
+# have the FTS_DOC_ID
+CREATE UNIQUE INDEX idx2 ON articles(id);
+
+# Recreate FTS index, this should not require a rebuild,
+# since the FTS_DOC_ID is still there
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+SELECT * FROM articles WHERE MATCH (title, body)
+	AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;

=== added file 'mysql-test/suite/innodb_fts/t/innodb-fts-fic.test'
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,231 @@
+# This is the basic function tests for innodb FTS
+
+-- source include/have_innodb.inc
+
+# Create FTS table
+CREATE TABLE articles (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+# Create the FTS index
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+SELECT * FROM articles WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT COUNT(*) FROM articles
+        WHERE MATCH (title, body)
+        AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+     WHERE MATCH (title, body)
+     AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+
+SELECT COUNT(IF(MATCH (title, body)
+        AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+        AS count FROM articles;
+
+ANALYZE TABLE articles;
+
+# Boolean search
+# Select rows contain "MySQL" but not "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+        AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+
+# Select rows contain at least one of the two words
+SELECT * FROM articles WHERE MATCH (title,body)
+        AGAINST ('DBMS Security' IN BOOLEAN MODE);
+
+# Select rows contain both "MySQL" and "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+        AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+
+DROP INDEX idx ON articles;
+
+# Create the FTS index
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+CREATE FULLTEXT INDEX idx1 on articles (title);
+
+SELECT * FROM articles WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP INDEX idx ON articles;
+
+DROP INDEX idx1 ON articles;
+
+CREATE FULLTEXT INDEX idx1 on articles (title);
+
+SELECT * FROM articles WHERE MATCH (title)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+drop table articles;
+
+# Create FTS table
+CREATE TABLE articles (
+	FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+create unique index FTS_DOC_ID_INDEX on articles(FTS_DOC_ID);
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+# Create the FTS index
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+# "the" is in the default stopword, it would not be selected
+SELECT * FROM articles WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+drop table articles;
+
+# Create FTS table
+CREATE TABLE articles (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	('How To Use MySQL Well','After you went through a ...'),
+	('Optimizing MySQL','In this tutorial we will show ...'),
+	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	('MySQL vs. YourSQL','In the following database comparison ...'),
+	('MySQL Security','When configured properly, MySQL ...');
+
+CREATE FULLTEXT INDEX idx on articles (title);
+CREATE FULLTEXT INDEX idx2 on articles (body);
+
+# "the" is in the default stopword, it would not be selected
+--error 1191
+SELECT * FROM articles WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles WHERE MATCH (title)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles WHERE MATCH (body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+drop index idx2 on articles;
+
+--error 1191
+SELECT * FROM articles WHERE MATCH (body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+CREATE FULLTEXT INDEX idx2 on articles (body);
+
+SELECT * FROM articles WHERE MATCH (body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+UPDATE articles set title = 'aaaa'
+WHERE MATCH(title) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles WHERE MATCH (title)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles WHERE MATCH (title)
+        AGAINST ('aaaa' IN NATURAL LANGUAGE MODE);
+
+drop table articles;
+
+CREATE TABLE articles (
+         FTS_DOC_ID BIGINT UNSIGNED NOT NULL ,
+	 title VARCHAR(200),
+         body TEXT
+         ) ENGINE=InnoDB;
+
+CREATE FULLTEXT INDEX idx on articles (title);
+
+INSERT INTO articles  VALUES (9, 'MySQL Tutorial','DBMS stands for DataBase ...');
+
+# This should fail since we did not supply a new Doc ID
+-- error 182
+UPDATE articles set title = 'bbbb'  WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+# This should fail, since the Doc ID supplied is less than the old value 9
+-- error 182
+UPDATE articles set title = 'bbbb', FTS_DOC_ID=8  WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+# This should be successful
+UPDATE articles set title = 'bbbb', FTS_DOC_ID=10  WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+# Check update to be successful
+SELECT * FROM articles WHERE MATCH (title) AGAINST ('bbbb' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles WHERE MATCH (title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+CREATE FULLTEXT INDEX idx2 ON articles (body);
+
+SELECT * FROM articles WHERE MATCH (body) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+UPDATE articles set body = 'bbbb', FTS_DOC_ID=11  WHERE MATCH(body) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+drop table articles;
+
+create table `articles`(`a` varchar(2) not null)engine=innodb;
+
+# This create index should fail. FTS_DOC_ID_INDEX is reserved as a unique
+# index on FTS_DOC_ID
+--error ER_INNODB_FT_WRONG_DOCID_INDEX
+create fulltext index `FTS_DOC_ID_INDEX` on `articles`(`a`);
+
+create unique index `a` on `articles`(`a`);
+
+drop table articles;
+
+# We will check validity of FTS_DOC_ID, which must be of an UNSIGNED
+# NOT NULL bigint 
+CREATE TABLE wp(
+   FTS_DOC_ID bigint PRIMARY KEY,
+   title VARCHAR(255) NOT NULL DEFAULT '',
+   text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB;
+
+INSERT INTO wp (FTS_DOC_ID, title, text) VALUES
+   (1, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+   (2, 'How To Use MySQL Well','After you went through a ...');
+
+--error ER_INNODB_FT_WRONG_DOCID_COLUMN
+CREATE FULLTEXT INDEX idx ON wp(title, text);
+
+DROP TABLE wp;
+CREATE TABLE wp(
+   FTS_DOC_ID bigint unsigned PRIMARY KEY,
+   title VARCHAR(255) NOT NULL DEFAULT '',
+   text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB;
+
+INSERT INTO wp (FTS_DOC_ID, title, text) VALUES
+   (1, 'MySQL Tutorial','DBMS stands for DataBase ...'),
+   (2, 'How To Use MySQL Well','After you went through a ...');
+
+CREATE FULLTEXT INDEX idx ON wp(title, text);
+
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database')
+
+FROM wp;
+
+DROP TABLE wp;
+

=== added file 'mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test'
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,670 @@
+# This is the basic function tests for innodb FTS
+
+-- source include/have_innodb.inc
+
+
+select * from information_schema.innodb_ft_default_stopword;
+
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# "the" is in the default stopword, it would not be selected
+SELECT * FROM articles WHERE MATCH (title,body)
+        AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+let $innodb_ft_server_stopword_table_orig=`select @@innodb_ft_server_stopword_table`;
+let $innodb_ft_enable_stopword_orig=`select @@innodb_ft_enable_stopword`;
+let $innodb_ft_user_stopword_table_orig=`select @@innodb_ft_user_stopword_table`;
+
+select @@innodb_ft_server_stopword_table;
+select @@innodb_ft_enable_stopword;
+select @@innodb_ft_user_stopword_table;
+
+# Provide user defined stopword table, if not (correctly) defined,
+# it will be rejected
+--error 1231
+set global innodb_ft_server_stopword_table = "not_defined";
+
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+
+drop index title on articles;
+
+create fulltext index idx on articles(title, body);
+
+# Now we should be able to find "the"
+SELECT * FROM articles WHERE MATCH (title,body)
+        AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+# Nothing inserted into the default stopword, so essentially
+# nothing get screened. The new stopword could only be
+# effective for table created thereafter
+CREATE TABLE articles_2 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+INSERT INTO articles_2 (title, body)
+        VALUES ('test for stopwords','this is it...');
+
+# Now we can find record with "this"
+SELECT * FROM articles_2 WHERE MATCH (title,body)
+        AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+# Ok, let's instantiate some value into user supplied stop word
+# table
+insert into user_stopword values("this");
+
+# Ok, let's repeat with the new table again.
+CREATE TABLE articles_3 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+INSERT INTO articles_3 (title, body)
+        VALUES ('test for stopwords','this is it...');
+
+# Now we should NOT find record with "this"
+SELECT * FROM articles_3 WHERE MATCH (title,body)
+        AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+# Test session level stopword control "innodb_user_stopword_table"
+create table user_stopword_session(value varchar(30)) engine = innodb;
+
+insert into user_stopword_session values("session");
+
+set session innodb_ft_user_stopword_table="test/user_stopword_session";
+
+CREATE TABLE articles_4 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+INSERT INTO articles_4 (title, body)
+        VALUES ('test for session stopwords','this should also be excluded...');
+
+# "session" is excluded
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+        AGAINST ('session' IN NATURAL LANGUAGE MODE);
+
+# But we can find record with "this"
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+        AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+--connect (con1,localhost,root,,)
+CREATE TABLE articles_5 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+INSERT INTO articles_5 (title, body)
+        VALUES ('test for session stopwords','this should also be excluded...');
+
+# "session" should be found since the stopword table is session specific
+SELECT * FROM articles_5 WHERE MATCH (title,body)
+        AGAINST ('session' IN NATURAL LANGUAGE MODE);
+
+--connection default
+drop table articles;
+drop table articles_2;
+drop table articles_3;
+drop table articles_4;
+drop table articles_5;
+drop table user_stopword;
+drop table user_stopword_session;
+
+eval SET GLOBAL innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
+eval SET GLOBAL innodb_ft_server_stopword_table=default;
+
+#---------------------------------------------------------------------------------------
+# Behavior  :
+# The stopword is loaded into memory at 
+# 1) create fulltext index time, 
+# 2) boot server, 
+# 3) first time FTs is used
+# So if you already created a FTS index, and then turn off stopword 
+# or change stopword table content it won't affect the FTS 
+# that already created since the stopword list are already loaded.
+# It will only affect the new FTS index created after you changed 
+# the settings.
+
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT `idx` (title,body)
+        ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','In what tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# Case : server_stopword=default 
+# Try to Search default stopword from innodb, "where", "will", "what"
+# and "when" are all stopwords
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+# boolean No result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+# no result expected
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+# no result expected 
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Not going to update as where condition can not find record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+# Update the record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 7;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Delete will not work as where condition do not return
+DELETE FROM articles WHERE  MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 7;
+DELETE FROM articles WHERE id = 7;
+
+
+
+# Case : Turn OFF stopword list variable and search stopword on OLD index.
+# disable stopword list
+#SET global innodb_ft_server_stopword_table = "";
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+#SET global innodb_ft_user_stopword_table = "";
+
+# search default stopword with innodb_ft_enable_stopword is OFF.
+# No records expected even though we turned OFF stopwod filtering
+# (refer Behavior (at the top of the test) for explanation ) 
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Not going to update as where condition can not find record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' 
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+# Update the record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' 
+WHERE id = 8;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+SELECT * FROM articles WHERE id = 8;
+# Delete will not work as where condition do not return
+DELETE FROM articles WHERE  MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 8;
+DELETE FROM articles WHERE id = 8;
+
+# Case : Turn OFF stopword list variable and search stopword on NEW index.
+# Drop index 
+ALTER TABLE articles DROP INDEX idx;
+SHOW CREATE TABLE articles;
+
+# Create the FTS index Using Alter Table. 
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+
+ANALYZE TABLE articles;
+
+# search default stopword with innodb_ft_enable_stopword is OFF.
+# All records expected as stopwod filtering is OFF and we created 
+# new FTS index.
+# (refer Behavior (at the top of the test) for explanation ) 
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Update will succeed.
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+
+SELECT COUNT(*),max(id) FROM articles;
+# Update the record - uncommet on fix
+#UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+#WHERE id = 9;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Delete will succeed.
+DELETE FROM articles WHERE  MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 9;
+
+
+DROP TABLE articles;
+
+eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
+#eval SET GLOBAL innodb_ft_server_stopword_table=$innodb_ft_server_stopword_table_orig;
+eval SET GLOBAL innodb_ft_server_stopword_table=default;
+#eval SET GLOBAL innodb_ft_user_stopword_table=$innodb_ft_user_stopword_table_orig;
+eval SET SESSION innodb_ft_user_stopword_table=default;
+
+#---------------------------------------------------------------------------------------
+
+select @@innodb_ft_server_stopword_table;
+select @@innodb_ft_enable_stopword;
+select @@innodb_ft_user_stopword_table;
+
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT `idx` (title,body)
+        ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','In what tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# No records expeced for select
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# Define a correct formated server stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+
+# Drop existing index and create the FTS index Using Alter Table. 
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Add values into server supplied stop word table
+insert into server_stopword values("what"),("where");
+# Follwoing should return result as server stopword list was empty at create index time
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+
+# Delete stopword from user list
+DELETE FROM user_stopword;
+# Drop existing index and create the FTS index Using Alter Table. 
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# Follwoing should return result even though to server stopword list 
+# conatin these words. Session level stopword list takes priority 
+# Here user_stopword is set using innodb_ft_user_stopword_table
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+
+# Follwoing should return result as user stopword list was empty at create index time
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+
+# Drop existing index and create the FTS index Using Alter Table. 
+ALTER TABLE articles DROP INDEX idx;
+SET SESSION innodb_ft_enable_stopword = 0;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Session level stopword list takes priority
+SET SESSION innodb_ft_enable_stopword = 1;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Make user stopword list deafult so as to server stopword list takes priority
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table = default;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+
+DROP TABLE articles,user_stopword,server_stopword;
+
+# Restore Defaults
+eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
+eval SET GLOBAL innodb_ft_server_stopword_table=default;
+eval SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+select @@innodb_ft_enable_stopword;
+select @@innodb_ft_user_stopword_table;
+
+#---------------------------------------------------------------------------------------
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT `idx` (title,body)
+        ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','In what tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# No records expeced for select
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("mysqld"),("DBMS");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+
+# Drop existing index and create the FTS index Using Alter Table. 
+# user stopword list will take effect.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+# set user stopword list empty
+set session innodb_ft_user_stopword_table = default;
+# Define a correct formated user stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into server_stopword values("root"),("properly");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+
+
+# set user stopword list empty
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+# user stopword list take effect as its session level 
+# Result expected for select
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+
+# set user stopword list
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+DELETE FROM user_stopword;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+DELETE FROM server_stopword;
+# user stopword list take affect as its session level 
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+DROP TABLE articles,user_stopword,server_stopword;
+
+# Restore Values
+eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
+eval SET GLOBAL innodb_ft_server_stopword_table=default;
+eval SET SESSION innodb_ft_user_stopword_table=default;
+
+
+#------------------------------------------------------------------------------
+# FTS stopword list test - check varaibles across sessions
+
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT `idx` (title,body)
+        ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','In what tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# session varaible innodb_ft_enable_stopword=0 will take effect for new FTS index
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+
+
+--echo "In connection 1"
+--connection con1
+select @@innodb_ft_enable_stopword;
+
+ANALYZE TABLE articles;
+
+# result expected as index created before setting innodb_ft_enable_stopword varaible off
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+SET SESSION innodb_ft_enable_stopword = 1;
+select @@innodb_ft_enable_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected turned innodb_ft_enable_stopword is ON
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+
+--echo "In connection default"
+--connection default
+select @@innodb_ft_enable_stopword;
+# no result expected as word not indexed from connection 1
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+
+
+--echo "In connection 1"
+--connection con1
+SET SESSION innodb_ft_enable_stopword = 1;
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+# Drop existing index and create the FTS index Using Alter Table. 
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected as innodb_ft_user_stopword_table filter it
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+
+--echo "In connection default"
+--connection default
+# no result expected as innodb_ft_user_stopword_table filter it from connection1 
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+select @@innodb_ft_user_stopword_table;
+# Define a correct formated user stopword table
+create table user_stopword_1(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+insert into user_stopword_1 values("when");
+SET SESSION innodb_ft_enable_stopword = 1;
+# result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+# Drop existing index and create the FTS index Using Alter Table. 
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+
+--echo "In connection 1"
+--connection con1
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_user_stopword_table;
+select @@innodb_ft_server_stopword_table;
+# Define a correct formated server stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+select @@innodb_ft_server_stopword_table;
+insert into server_stopword values("when"),("the");
+# Drop existing index and create the FTS index Using Alter Table. 
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo "In connection default"
+--connection default
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+# result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+insert into server_stopword values("where"),("will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+
+
+DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
+
+# Restore Values
+eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
+eval SET GLOBAL innodb_ft_server_stopword_table=default;
+eval SET SESSION innodb_ft_user_stopword_table=default;
+

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,379 @@
+# This test for FTS index with big records
+# case a) more words in single record
+# b) more words across records
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+        a TEXT,
+        b TEXT
+        ) ENGINE = InnoDB;
+
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID);
+
+let $counter = 1;
+--disable_query_log
+
+# Generate input file using perl
+perl;
+use strict;
+my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/fts_input_data1.txt";
+open FH,">$fname";
+my $record_counter = 1;
+while ($record_counter < 50) { 
+   my $word_counter = 1;
+   my ($col1,$col2);
+   while ($word_counter < 51) {
+       $col1 = $col1. "row".$record_counter."col1"."word".$word_counter." ";
+       $col2 = $col2. "row".$record_counter."col2"."word".$word_counter." ";
+       $word_counter++;
+   }
+   print FH "$col1,$col2\n";
+   $record_counter++;
+}
+close FH;
+EOF
+
+EVAL LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/fts_input_data1.txt' INTO 
+TABLE t1 FIELDS TERMINATED BY ',' (a,b);
+--enable_query_log
+--echo "Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data1.txt"
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+SELECT COUNT(*) FROM t1;
+
+# Select word "tutorial" in the table
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+        AGAINST ('row35col2word49' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row5col2word49" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row35col2word49 +(row35col1word49 row35col2word40)" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("+row35col2word49 -(row45col2word49)" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST("row5col2word49 row5col2word40" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH a,b AGAINST ("+row5col2word* +row5col1word49*" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH a,b AGAINST ('"row35col2word49"' IN BOOLEAN MODE);
+SELECT COUNT(*) from t1
+WHERE MATCH a,b AGAINST ('"ROW35col2WORD49"' IN BOOLEAN MODE);
+
+# query expansion
+SELECT COUNT(*) from t1
+WHERE MATCH(a,b) AGAINST ("row5col2word49" WITH QUERY EXPANSION);
+
+SELECT FTS_DOC_ID FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"row5col2word48 row5col2word49"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"row5col2word48 row5col2word49"@1' IN BOOLEAN MODE);
+
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", FTS_DOC_ID = FTS_DOC_ID + 10000
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+--remove_file '$MYSQLTEST_VARDIR/tmp/fts_input_data1.txt';
+DROP TABLE t1;
+
+#--------------------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+        a TEXT,
+        b TEXT
+        ) ENGINE = InnoDB;
+
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); 
+
+let $counter = 1;
+--disable_query_log
+
+# Generate input file using perl
+perl;
+use strict;
+my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/fts_input_data2.txt";
+open FH,">$fname";
+my $record_counter = 1;
+while ($record_counter < 101) { 
+   my $word_counter = 1;
+   my ($col1,$col2);
+   while ($word_counter < 50) {
+       $col1 = $col1. "row".$record_counter."col1"."word".$word_counter." ";
+       $col2 = $col2. "row".$record_counter."col2"."word".$word_counter." ";
+       $word_counter++;
+   }
+   print FH "$col1,$col2\n";
+   $record_counter++;
+}
+close FH;
+EOF
+
+EVAL LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/fts_input_data2.txt' 
+INTO TABLE t1 FIELDS TERMINATED BY ',' (a,b);
+--enable_query_log
+--echo "Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data2.txt"
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+SELECT COUNT(*) FROM t1;
+
+SELECT FTS_DOC_ID from t1 WHERE b like '%row300col2word30%';
+
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+        AGAINST ('row35col2word49' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row5col2word49" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row35col2word49 +(row35col1word49 row35col2word40)" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+row35col2word49 -(row45col2word49)" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("row5col2word49 row5col2word40" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ("+row5col2word* +row5col1word49*" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ('"row35col2word49"' IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ('"ROW35col2WORD49"' IN BOOLEAN MODE);
+
+# query expansion
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST ("row5col2word49" WITH QUERY EXPANSION);
+
+SELECT FTS_DOC_ID FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"row5col2word48 row5col2word49"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"row5col2word48 row5col2word49"@1' IN BOOLEAN MODE);
+
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", FTS_DOC_ID = FTS_DOC_ID + 10000
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+
+SELECT a,b FROM t1
+WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE);
+SELECT a,b FROM t1
+WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+SELECT a,b FROM t1
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+ALTER TABLE t1 DROP INDEX idx;
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+UPDATE t1 SET a = NULL , b = NULL, FTS_DOC_ID= 6000 + FTS_DOC_ID;
+
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+ALTER TABLE t1 DROP INDEX idx;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+
+--remove_file '$MYSQLTEST_VARDIR/tmp/fts_input_data2.txt';
+DROP TABLE t1;
+
+#--------------------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+        a TEXT,
+        b TEXT
+        ) ENGINE = InnoDB;
+
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); 
+
+let $counter = 1;
+--disable_query_log
+
+# Generate input file using perl
+perl;
+use strict;
+my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/fts_input_data3.txt";
+open FH,">$fname";
+my $record_counter = 1;
+while ($record_counter < 101) { 
+   my $word_counter = 1;
+   my ($col1,$col2);
+   while ($word_counter < 50) {
+       $col1 = $col1. "samerowword" ." ";
+       $col2 = $col2. "samerowword" ." ";
+       $word_counter++;
+   }
+   print FH "$col1,$col2\n";
+   $record_counter++;
+}
+close FH;
+EOF
+
+EVAL LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/fts_input_data3.txt' 
+INTO TABLE t1 FIELDS TERMINATED BY ',' (a,b);
+--enable_query_log
+--echo "Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data3.txt"
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+SELECT COUNT(*) FROM t1;
+
+SELECT COUNT(*) from t1 WHERE b like '%samerowword%';
+
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b)
+        AGAINST ('samerowword' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword -(row45col2word49)" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH a,b AGAINST ("+sameroww" IN BOOLEAN MODE);
+
+# query expansion
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST ("samerowword" WITH QUERY EXPANSION);
+
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", 
+FTS_DOC_ID = FTS_DOC_ID + 10000 
+WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE);
+
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+ALTER TABLE t1 DROP INDEX idx;
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+UPDATE t1 SET a = NULL , b = NULL ;
+
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+ALTER TABLE t1 DROP INDEX idx;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+
+--remove_file '$MYSQLTEST_VARDIR/tmp/fts_input_data3.txt';
+DROP TABLE t1;
+
+#--------------------------------------------------------------------------------------------
+# Create FTS with same word and numbers
+EVAL CREATE TABLE t1 (
+        FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
+        a TEXT,
+        b TEXT
+        ) ENGINE = InnoDB;
+
+CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); 
+
+
+let $counter = 1;
+--disable_query_log
+
+# Generate input file using perl
+perl;
+use strict;
+my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/fts_input_data4.txt";
+open FH,">$fname";
+my $record_counter = 1;
+while ($record_counter < 101) { 
+   my $word_counter = 1001;
+   my ($col1,$col2);
+   while ($word_counter < 1101) {
+       $col1 = $col1. "samerowword" ." ";
+       $col2 = $col2. "$word_counter" ." ";
+       $word_counter++;
+   }
+   print FH "$col1,$col2\n";
+   $record_counter++;
+}
+close FH;
+EOF
+
+EVAL LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/fts_input_data4.txt' 
+INTO TABLE t1 FIELDS TERMINATED BY ',' (a,b);
+--enable_query_log
+--echo "Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data4.txt"
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+SELECT COUNT(*) FROM t1;
+
+SELECT COUNT(*) from t1 WHERE a like '%samerowword%';
+
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b)
+        AGAINST ('samerowword' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword -(1050)" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 WHERE MATCH a,b AGAINST ("+2001" IN BOOLEAN MODE);
+
+# query expansion
+SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST ("samerowword" WITH QUERY EXPANSION);
+
+UPDATE t1 SET a = "using update" , b = "changing fulltext index record", 
+FTS_DOC_ID = FTS_DOC_ID + 10000 
+WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE);
+
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+DELETE FROM t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+SELECT COUNT(*) from t1 
+WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE);
+
+ALTER TABLE t1 DROP INDEX idx;
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+UPDATE t1 SET a = NULL , b = NULL ;
+
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+ALTER TABLE t1 DROP INDEX idx;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL;
+
+--remove_file '$MYSQLTEST_VARDIR/tmp/fts_input_data4.txt';
+DROP TABLE t1;
+

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_misc.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,1160 @@
+#------------------------------------------------------------------------------
+# Test With alter/create/drop index
+#------------------------------------------------------------------------------
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+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 ...');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+# query expansion
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+
+# Drop index 
+ALTER TABLE t1 DROP INDEX idx;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+# query expansion
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+
+# insert for proximity search 
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity fts search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test more proximity fts search, test, more proximity and phrase',
+         'search, with proximity innodb');
+
+# This should only return the first document
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+
+# Similar boundary testing for the words
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT id FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+
+
+#------------------------------------------------------------------------------
+# Test with FTS condition in subquery
+#------------------------------------------------------------------------------
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Insert rows
+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 ...');
+
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id = (SELECT MAX(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+
+
+# Select word "tutorial" in the table - innodb crash
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+) OR t1.id = 3 ;
+
+
+# Select word "tutorial" in the table  - innodb crash
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 
+WHERE MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) 
+AND t2.id != 3) ;
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE 
+MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+
+# Select word except  "tutorial" in the table
+SELECT id FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1 
+WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ;
+
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) 
+AND t1.id = t2.id) ;
+
+
+# Select not word like "tutorial" using subquery
+SELECT id FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) 
+AND t1.id = t2.id) ;
+
+DROP TABLE t1;
+
+# boolean search 
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT ,
+        FULLTEXT (a,b)
+        ) ENGINE = InnoDB;
+
+INSERT INTO t1(a,b) VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE 
+        MATCH(t2.a,t2.b) AGAINST("+support +collections" IN BOOLEAN MODE));
+SELECT id FROM t1 WHERE t1.id != (SELECT MIN(t2.id) FROM t1 AS t2 WHERE 
+        MATCH(t2.a,t2.b) AGAINST("+search" IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE 
+MATCH (t2.a,t2.b) AGAINST ("+call* +coll*" IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE 
+MATCH t2.a,t2.b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE) AND t2.id=t1.id);
+
+
+#query expansion search
+# result differ for query expansion search even wo subquery
+#SELECT id FROM t1 WHERE t1.id = ( SELECT  MAX(t2.id) FROM t1 AS t2 WHERE 
+#MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION));
+#SELECT id FROM t1 WHERE t1.id IN ( SELECT t2.id FROM t1 AS t2 WHERE
+#MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION));
+#SELECT id FROM t1 WHERE ( SELECT COUNT(*) FROM t1 AS t2 WHERE
+#MATCH(t2.a,t2.b) AGAINST ("indexes collections" WITH QUERY EXPANSION)) >= 1 
+#AND t1.id <=3 ;
+
+# proximity search 
+# insert for proximity search 
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity fts search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test more proximity fts search, test, more proximity and phrase',
+         'search, with proximity innodb');
+
+
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+SELECT id FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"proximity search"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@3' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+
+
+#------------------------------------------------------------------------------
+# create table AS SELECT from fts indexed table
+#------------------------------------------------------------------------------
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('support') ;
+SHOW CREATE TABLE t2;
+SELECT id FROM t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST("+support +collections" IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+SELECT id FROM t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('"proximity search"@10' IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+SELECT id FROM t2;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+
+#------------------------------------------------------------------------------
+# Verift FTS with NULL records
+#------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...');
+
+let $counter = 50;
+--disable_query_log
+WHILE ($counter > 0) {
+   INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+   dec $counter;
+}
+--enable_query_log
+INSERT INTO t1 (a,b) VALUES
+('when To Use MySQL Well','After that you went through a ...');
+
+let $counter = 50;
+--disable_query_log
+WHILE ($counter > 0) {
+   INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+   dec $counter;
+}
+--enable_query_log
+INSERT INTO t1 (a,b) VALUES
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+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 null...');
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL;
+SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL;
+
+SELECT id FROM t1
+     WHERE MATCH (a,b)
+     AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT id FROM t1
+     WHERE MATCH (a,b)
+     AGAINST (NULL IN NATURAL LANGUAGE MODE);
+SELECT id FROM t1
+     WHERE MATCH (a,b)
+     AGAINST (NULL WITH QUERY EXPANSION);
+SELECT id FROM t1
+     WHERE MATCH (a,b)
+     AGAINST ('null' IN NATURAL LANGUAGE MODE);
+# Boolean search
+# Select rows contain "MySQL" but not "YourSQL"
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NOT NULL OR b IS NOT NULL);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NULL AND b IS NOT NULL);
+
+# Select rows contain at least one of the two words
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+
+# Test query expansion
+SELECT COUNT(*) FROM t1
+WHERE MATCH (a,b)
+AGAINST ('database' WITH QUERY EXPANSION);
+
+# proximity
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"following database"@10' IN BOOLEAN MODE);
+
+
+DROP TABLE t1;
+
+
+
+#------------------------------------------------------------------------------
+# More FTS test from peter's testing
+#------------------------------------------------------------------------------
+--disable_warnings
+drop table if exists t50;
+--enable_warnings
+
+set names utf8;
+
+
+--echo "----------Test1---------"
+# Create FTS table
+create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb;
+create fulltext index i on t50 (s1);
+# INNODB_FTS: Assert - fixed
+# Assert : InnoDB: Failing assertion: rbt_validate(result_doc->tokens)
+insert into t50 values ('ABCDE'),('FGHIJ'),('KLMNO'),('V����W��');
+# it was giving empty result set instead of one record  
+select * from t50 where match(s1) against ('V����W��'); 
+drop table t50;
+
+
+--echo "----------Test2---------"
+create table t50 (s1 int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('V����W��'),('ABCDE');
+# INNODB_FTS: RESULT DIFF
+# Order by does not sort result. 
+# Optimizer's Evgeny is investigate a similar issue. InnoDB FTS is used only 
+# for FT search, and should not be used as regular index for such order by query. 
+# Correct the result file when fixed.
+select * from t50 order by s2; 
+drop table t50;
+
+
+--echo "----------Test3---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('V����W��'),('ABCDE');
+set @@autocommit=0;
+update t50 set s2 = lower(s2);
+update t50 set s2 = upper(s2); 
+commit;
+select * from t50 where match(s2) against ('V����W�� FGHIJ KLMNO ABCDE' in boolean mode);
+select * from t50;
+drop table t50;
+set @@autocommit=1;
+
+--echo "----------Test4---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('V����W��'),('ABCD*');
+select * from t50 where match(s2) against ('abcd*' in natural language
+mode); 
+# INNODB_FTS: RESULT DIFF(Expected). InnoDB do not index "*", so
+# word "ABCD" indexed, instead of "ABCD*"
+select * from t50 where match(s2) against ('abcd*' in boolean mode); 
+drop table t50;
+
+
+--echo "----------Test5---------"
+create table t50 (s1 int, s2 varchar(200), fulltext key(s2)) engine = innodb;
+set @@autocommit=0;
+insert into t50 values (1,'Sunshine'),(2,'Lollipops');
+select * from t50 where match(s2) against('Rainbows');
+rollback;
+select * from t50;
+drop table t50;
+set @@autocommit=1;
+
+--echo "----------Test6---------"
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('aab` MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('aas How To Use MySQL Well','After you went through a ...'),
+        ('aac Optimizing MySQL','In this tutorial we will show ...');
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('aac 1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('aab MySQL vs. YourSQL','In the following database comparison ...'),
+        ('aaa MySQL Security','When configured properly, MySQL ...');
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+-- disable_query_log
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+-- enable_query_log
+
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aac') DESC;
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aab') DESC; 
+
+--echo "----------Test7---------"
+select * from t1 where match(a,b) against ('aaa')
+union select * from t1 where match(a,b) against ('aab')
+union select * from t1 where match(a,b) against ('aac');
+
+select * from t1 where match(a,b) against ('aaa')
+                or    match(a,b) against ('aab')
+                or    match(a,b) against ('aac'); 
+
+DROP TABLE t1;
+
+--echo "----------Test8---------"
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ... abcd')  ,
+        ('How To Use MySQL Well','After you went through a q ...abdd'),
+        ('Optimizing MySQL','In this tutorial we will show ...abed');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. q ...'),
+        ('MySQL vs. YourSQL use','In the following database comparison ...'),
+        ('MySQL Security','When run configured properly, MySQL ...');
+
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went');
+# rows should be matched as 'q' is single char its not indexed
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run') AND NOT MATCH(a,b) AGAINST ('q');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use') AND NOT MATCH(a,b) AGAINST ('q');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went') AND NOT MATCH(a,b) AGAINST ('q');
+
+--echo "----------Test9---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SET @x = (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+# Innodb returns value for x which is correct
+SELECT @x, @x2;
+
+
+DROP TABLE t2;
+
+--echo "----------Test10---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+
+DROP TABLE t2;
+
+
+--echo "----------Test11---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE = MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+ALTER TABLE t2 ENGINE=InnoDB;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+DROP TABLE t2,t1;
+
+
+--echo "----------Test13---------"
+set names utf8;
+
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_SPANISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+INSERT INTO t1 VALUES (1,'aaCen'),(2,'aaCha'),(3,'aaCio'),(4,'aa��en'),(5,'aa��ha'),(6,'aa��io');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aach*' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aaC*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo "----------Test14---------"
+CREATE TABLE t1(s1 INT , s2 VARCHAR(100) CHARACTER SET sjis) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+INSERT INTO t1 VALUES (1,'���������'),(2,'���������'),(3,'���������'),(4,'���������');
+# Innodb Asset : file ha_innodb.cc line 4557
+#SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('������*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+
+--echo "----------Test15---------"
+CREATE TABLE t1 (s1 VARCHAR (60) CHARACTER SET UTF8 COLLATE UTF8_UNICODE_520_CI) ENGINE = MyISAM;
+CREATE FULLTEXT INDEX i ON t1 (s1);
+INSERT INTO t1 VALUES
+('a'),('b'),('c'),('d'),('��������'),('LLLL'),(NULL),('�������� ��������'),('LLLLLLLL');
+SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+DROP TABLE if EXISTS t2;
+CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t2 ( s1);
+INSERT INTO t2 VALUES
+('a'),('b'),('c'),('d'),('��������'),('LLLL'),(NULL),('�������� ��������'),('LLLLLLLL');
+SELECT * FROM t2 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+--disable_warnings
+DROP TABLE t1,t2;
+--enable_warnings
+
+--echo "----------Test16---------"
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(50) CHARACTER SET UTF8) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1(s2);
+INSERT INTO t1 VALUES (2, '���� Da��i      p          ');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('+p +"���� Da��i*"' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+
+--echo "----------Test19---------"
+#19 Failure with Boolean quoted search
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'��������');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('"��������"' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo "----------Test20---------"
+#20 Crash with utf32 and boolean mode.
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_column2 VARCHAR(60) character set utf8) ENGINE = InnoDB;
+INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu');
+UPDATE t1 SET char_column2 = char_column;
+CREATE FULLTEXT INDEX i ON t1 (char_column2);
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo "----------Test22---------"
+# case 22
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'aaa'),(2,'bbb'),(3,'ccc');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+HANDLER t1 OPEN;
+HANDLER t1 READ i = ('aaa');
+DROP TABLE t1;
+#23. Duplicate key error when there are no unique indexes (procedure test)
+#24 Failure after cascading update - already have tests
+
+--echo "----------Test25---------"
+#25 Failure with Croatian boolean truncated search.
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_CROATIAN_CI) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'��in'),(2,'ljin'),(3,'lmin'),(4,'����������');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+#inndob:error incorrect result correct it after fix
+SELECT count(*) FROM t1 WHERE MATCH (char_column) AGAINST ('lj*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#26. Index error when run procedure call from multiple clients
+
+--echo "----------Test27---------"
+#27 Crash after server restart
+CREATE TABLE t1 (id INT,char_column VARCHAR(60));
+SET @@autocommit=0;
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+INSERT INTO t1 values (1,'aaa');
+echo "restart server..."
+# Restart the server
+--source include/restart_mysqld.inc
+DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
+SET @@autocommit=1;
+DROP TABLE t1;
+
+--echo "----------Test28---------"
+drop table if exists `fts_test`;
+create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
+set session autocommit=0;
+insert into `fts_test` values ('');
+savepoint `b`;
+savepoint `b`;
+set session autocommit=1;
+DROP TABLE fts_test;
+
+# Continue test savepoint related operations. With a commit after
+# multiple rollback to savepoints
+--echo "----------Test29---------"
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+
+start transaction;
+
+INSERT INTO articles (title,body) VALUES 
+('How To Use MySQL Well','After you went through a ...');
+
+savepoint `a1`;
+
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+
+savepoint `a2`;
+
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+savepoint `a3`;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+
+savepoint `a4`;
+
+# FTS do not parse those uncommitted rows, only one row should show up
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+rollback to savepoint a3;
+
+# The last inserted row should not be there
+select title, body from articles;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+
+savepoint `a5`;
+
+select title, body from articles;
+
+rollback to savepoint a2;
+
+select title, body from articles;
+
+commit;
+
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Continue test savepoint related operations. With a rollback after
+# multiple rollback to savepoints
+--echo "----------Test30---------"
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+start transaction;
+
+INSERT INTO articles (title,body) VALUES 
+('How To Use MySQL Well','After you went through a ...');
+
+savepoint `a1`;
+
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+
+savepoint `a2`;
+
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+savepoint `a3`;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+
+savepoint `a4`;
+
+# FTS do not parse those uncommitted rows, only one row should show up
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+rollback to savepoint a3;
+
+# The last inserted row should not be there
+select title, body from articles;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+
+savepoint `a5`;
+
+select title, body from articles;
+
+rollback to savepoint a2;
+
+select title, body from articles;
+
+rollback;
+
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Test for Bug #13907075 - DIFFERENT RESULTS FOR DIFFERENT TERM ORDER
+# WITH INNODB BOOLEAN FULLTEXT SEARCH. The FTS_IGNORE ("-") operation
+# is orderless
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+-- disable_result_log
+ANALYZE TABLE articles;
+-- enable_result_log
+
+SELECT *,  MATCH(title, body) AGAINST ('-database +MySQL' IN BOOLEAN MODE) AS score from articles;
+
+SELECT *, MATCH(title, body) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score  FROM articles;
+
+# With subquery
+SELECT * FROM articles where  MATCH(title, body) AGAINST ('MySQL - (database - tutorial)' IN BOOLEAN MODE);
+
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database)' IN BOOLEAN MODE);
+
+# More complex query
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database) -Tricks' IN BOOLEAN MODE);
+
+SELECT * FROM articles where MATCH(title, body) AGAINST ('-Tricks MySQL - (- tutorial database)' IN BOOLEAN MODE);
+
+DROP TABLE articles;
+
+# Test for Bug 13940669 - 64901: INNODB: ASSERTION FAILURE IN
+# THREAD 34387022112 IN FILE REM0CMP.CC LINE 5
+
+drop table if exists t1;
+
+create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key,
+title varchar(200),body text,fulltext(title,body)) engine=innodb;
+
+insert into t1 set body='test';
+
+select * from t1 where match(title,body) against('%test');
+
+select * from t1 where match(title,body) against('%');
+
+select * from t1 where match(title,body) against('%%%%');
+
+drop table t1;
+
+# Test for Bug 13881758 - 64745: CREATE FULLTEXT INDEX CAUSES CRASH
+# Create a database with empty space in its name
+CREATE DATABASE `benu database`;
+
+USE `benu database`;
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+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 ...');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+DROP DATABASE `benu database`;
+
+USE test;
+
+# Test for Bug #14101706 - CRASH WITH DDL IN ROW_MERGE_BUILD_INDEXES
+# WHEN FULLTEXT INDEXES EXIST
+
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`), fulltext key (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER  TABLE `t21` ADD UNIQUE INDEX (`b`), ALGORITHM=INPLACE;
+ALTER  TABLE `t21` ADD UNIQUE INDEX (`b`);
+
+DROP TABLE t21;
+
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`)) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+
+ALTER  TABLE `t21` ADD UNIQUE INDEX (`b`);
+
+DROP TABLE t21;
+
+# Test primary index rebuild
+CREATE TABLE t1 (
+        id INT NOT NULL,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+        (1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        (2, 'How To Use MySQL Well','After you went through a ...'),
+        (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+ALTER  TABLE t1 ADD UNIQUE INDEX (`id`);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+
+DROP TABLE t1;
+
+# Test create the FTS and primary index in the same clause
+CREATE TABLE t1 (
+        id INT NOT NULL,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+        (1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        (2, 'How To Use MySQL Well','After you went through a ...'),
+        (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER  TABLE t1 ADD UNIQUE INDEX (`id`), ADD FULLTEXT INDEX idx (a,b);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+# Create FTS table with FTS_DOC_ID already existed
+CREATE TABLE t1 (
+        FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+        (1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        (2, 'How To Use MySQL Well','After you went through a ...'),
+        (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+ALTER  TABLE t1 ADD UNIQUE INDEX (`FTS_DOC_ID`);
+
+# Select word "tutorial" in the table
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+
+DROP TABLE t1;
+
+# Create FTS table with FTS_DOC_ID and FTS_DOC_ID_INDEX
+CREATE TABLE t1 (
+        FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+        (1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        (2, 'How To Use MySQL Well','After you went through a ...'),
+        (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b), ADD UNIQUE INDEX FTS_DOC_ID_INDEX (FTS_DOC_ID);
+
+# Select word "tutorial" in the table
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+
+DROP TABLE t1;
+
+# Test for bug #14079609 - FTS: CRASH IN FTS_TRX_TABLE_CMP WITH SAVEPOINTS, XA
+
+CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB
+DEFAULT CHARSET=LATIN1;
+
+CREATE TABLE t3 LIKE t2;
+
+INSERT INTO `t2` VALUES();
+
+COMMIT WORK AND CHAIN;
+
+INSERT  INTO `t3` VALUES ();
+UPDATE  `t2` SET `b` = 'a';
+
+SAVEPOINT BATCH1;
+
+DROP TABLE t2;
+DROP TABLE t3;
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+COMMIT WORK AND CHAIN;
+
+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 ...');
+
+SAVEPOINT BATCH1;
+
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+INSERT INTO t1 (a,b) VALUES
+        ('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+
+ROLLBACK TO SAVEPOINT BATCH1;
+
+COMMIT;
+
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE t1;
+
+# Test for Bug 14588091 - FTS: BUFFER OVERFLOW IN FTS_AST_CREATE_NODE_TEXT
+CREATE TABLE `t` (`a` char(20) character set utf8 default null,
+fulltext key (`a`)) ENGINE=INNODB;
+INSERT INTO `t` VALUES ('a');
+INSERT INTO `t` VALUES ('aaa');
+
+# 0x22 is the '"', 0xdd is not encoded in utf8
+SELECT MATCH(`a`) AGAINST (0x22dd22) FROM `t`;
+SELECT MATCH(`a`) AGAINST (0x2222) FROM `t`;
+SELECT MATCH(`a`) AGAINST (0x22) FROM `t`;
+
+# this should show one match
+SELECT MATCH(`a`) AGAINST (0x2261616122) FROM `t`;
+
+# again 0xdd should be ignored
+SELECT MATCH(`a`) AGAINST (0x2261dd6122) FROM `t`;
+
+SELECT MATCH(`a`) AGAINST (0x2261dd612222226122) FROM `t`;
+
+DROP TABLE t;
+
+# InnoDB FTS does not support index scan from handler
+CREATE TABLE t(a CHAR(1),FULLTEXT KEY(a)) ENGINE=INNODB;
+HANDLER t OPEN;
+HANDLER t READ a NEXT;
+HANDLER t READ a PREV;
+DROP TABLE t;
+
+CREATE TABLE `%`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+CREATE TABLE `A B`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+DROP TABLE `%`;
+DROP TABLE `A B`;
+
+CREATE TABLE `t-26`(a VARCHAR(10),FULLTEXT KEY(a)) ENGINE=INNODB;
+INSERT INTO `t-26` VALUES('117');
+DROP TABLE `t-26`;

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,898 @@
+#------------------------------------------------------------------------------
+# FTS with FK and update cascade
+#-------------------------------------------------------------------------------
+--disable_warnings
+drop table if exists t2,t1;
+--enable_warnings
+
+set names utf8;
+
+# Create FTS table
+CREATE TABLE t1 (
+        id1 INT ,
+        a1 VARCHAR(200) ,
+        b1 TEXT ,
+        FULLTEXT KEY (a1,b1), PRIMARY KEY (a1, id1)
+        ) CHARACTER SET = utf8 , ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+        id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a2 VARCHAR(200),
+        b2 TEXT ,
+        FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+        FULLTEXT KEY (b2,a2)
+        ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+        (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 ...');
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+        (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 ...');
+
+# Insert rows in t2 fk table
+INSERT INTO t2 (a2,b2) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Insert rows t2 fk table
+INSERT INTO t2 (a2,b2) 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 ...');
+
+# error on violating fk constraint
+--error 1452
+INSERT INTO t2 (a2,b2) VALUES
+        ('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+# error on delete from parent table
+--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') ;
+
+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' 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 ('"dbms database"@4' IN BOOLEAN MODE) ;
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+
+set global innodb_optimize_fulltext_only=1;
+optimize table t1;
+set global innodb_optimize_fulltext_only=0;
+# Updating parent table hence child table should get updated due to 'update cascade' clause
+UPDATE t1 SET a1 = "changing column - on update cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+
+# no records expected
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+# InnoDB:Error child table shows records which is incorrect - UPADTE on Fix
+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) ;
+# 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%';
+
+DROP TABLE t2 , t1;
+
+# on update cascade
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+  fulltext key(s2),
+  foreign key (s1,s2) references t1 (s1,s2) on update cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+# on delete cascade
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+  fulltext key(s2),
+  foreign key (s1,s2) references t1 (s1,s2) on delete cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1  where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+# on delete set NULL
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+  fulltext key(s2),
+  foreign key (s1,s2) references t1 (s1,s2) on delete set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1 where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+# on update set NULL
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+  fulltext key(s2),
+  foreign key (s1,s2) references t1 (s1,s2) on update set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+# When Doc ID is involved
+create table t1 (s1 bigint unsigned not null, s2 varchar(200),
+		 primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL, s2 varchar(200),
+		 foreign key (FTS_DOC_ID) references t1 (s1)
+		 on update cascade) ENGINE = InnoDB;
+
+create fulltext index idx on t2(s2);
+
+show create table t2;
+
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+
+update t1 set s1 = 3 where s1=1;
+
+select * from t2 where match(s2) against ('sunshine');
+
+# FTS Doc ID cannot be reused
+--error 1451
+update t1 set s1 = 1 where s1=3;
+
+DROP TABLE t2 , t1;
+
+#------------------------------------------------------------------------------
+# FTS with FK and delete casecade
+#------------------------------------------------------------------------------
+
+# Create FTS table
+CREATE TABLE t1 (
+        id1 INT ,
+        a1 VARCHAR(200) PRIMARY KEY,
+        b1 TEXT character set utf8 ,
+        FULLTEXT KEY (a1,b1)
+        ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+        id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a2 VARCHAR(200),
+        b2 TEXT character set utf8 ,
+        FOREIGN KEY (a2) REFERENCES t1(a1) ON DELETE CASCADE,
+        FULLTEXT KEY (b2,a2)
+        ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+        (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 ...');
+
+# Insert rows in t2
+INSERT INTO t2 (a2,b2) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# delete records from parent
+DELETE FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+
+# no records expected
+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 a1 LIKE '%tutorial%';
+SELECT * FROM t2 WHERE a2 LIKE '%tutorial%';
+
+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;
+
+# Create FTS table
+CREATE TABLE t1 (
+        id1 INT ,
+        a1 VARCHAR(200) ,
+        b1 TEXT ,
+        FULLTEXT KEY (a1,b1), PRIMARY KEY(a1, id1)
+        ) CHARACTER SET = utf8 , ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+        id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a2 VARCHAR(200),
+        b2 TEXT ,
+        FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+        FULLTEXT KEY (b2,a2)
+        ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+        (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 ...');
+
+# Insert rows in t2 fk table
+INSERT INTO t2 (a2,b2) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+START TRANSACTION;
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+        (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 ...');
+
+# Insert rows t2 fk table
+INSERT INTO t2 (a2,b2) 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 ...');
+
+# error on violating fk constraint
+--error 1452
+INSERT INTO t2 (a2,b2) VALUES
+        ('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+# error on DELETE FROM parent table
+--error 1451
+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 ('"dbms database"@4' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+
+# no records as data not COMMITted.
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root') ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root') ;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('mysqld (+root)' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('mysqld (-root)' IN BOOLEAN MODE) ;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root' WITH QUERY EXPANSION) ;
+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;
+
+COMMIT;
+
+START TRANSACTION;
+# Updating parent table hence child table should get updated due to 'UPDATE cascade' clause
+UPDATE t1 SET a1 = "changing column - on UPDATE cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -V����W��)' IN BOOLEAN MODE) ;
+COMMIT;
+
+# no records expected
+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) ;
+
+# 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%';
+
+DROP TABLE t2 , t1;
+
+
+# FTS with FK+transactions - UPDATE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions -  on DELETE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1  WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions -  DELETE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+# FTS with FK+transactions -  UPDATE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+#-----------------------------------------------------------------------------
+
+# FTS with FK+transactions - UPDATE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions - DELETE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1  WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions - DELETE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+# FTS with FK+transactions - UPDATE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+  FULLTEXT KEY(s2),
+  FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+#------------------------------------------------------------------------------
+# FTS index with compressed row format
+#------------------------------------------------------------------------------
+
+# Save innodb variables
+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`;
+
+# 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 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = utf8, ROW_FORMAT=COMPRESSED, ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase V����W��...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+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 ...');
+
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +V����W��" IN BOOLEAN MODE);
+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 ("+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);
+
+# Drop index 
+ALTER TABLE t1 DROP INDEX idx;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+-- disable_query_log
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+-- enable_query_log
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# 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;
+# 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);
+
+
+# insert for proximity search 
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity fts search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test more proximity fts search, test, more proximity and phrase',
+         'search, with proximity innodb');
+
+# This should only return the first document
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+
+# Similar boundary testing for the words
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"more fts proximity"@03' IN BOOLEAN MODE);
+
+
+UPDATE t1 SET a = UPPER(a) , b = UPPER(b) ;
+UPDATE t1 SET a = UPPER(a) , b = LOWER(b) ;
+
+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);
+
+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);
+
+
+SELECT * FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * 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;
+eval SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
+eval SET GLOBAL innodb_large_prefix=$innodb_large_prefix_orig;
+
+#------------------------------------------------------------------------------
+# FTS index with utf8 character testcase
+#------------------------------------------------------------------------------
+set names utf8;
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = utf8, ENGINE=InnoDB;
+
+
+# Insert rows from different languages
+INSERT INTO t1 (a,b) VALUES
+('�� �������� �������� ������������', '������ ������ ���� ������������'),
+('�������� ���� ���� ������������', '���� ���� ���� ����������'),
+('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+('P����li�� ��lu��ou��k�� k����', '��p��l ����belsk�� k��dy'),
+('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t'),
+('���������������������','���������������'),
+('������������������������������������','���������������������������������������');
+
+# insert english text
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','request docteam at oraclehelp.com ...')  ,
+        ('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...')  ,
+        ('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+
+# Create the FTS index again
+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 ("������" WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("��������*" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+������������� +tutorial" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+tutorial +(�������� ������������)" IN BOOLEAN MODE);
+
+# Innodb:error - no result returned (update result of query once fixed) (innodb limit , does not understand character boundry for japanses like charcter set)
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("���������������������������������������");
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("������������" WITH QUERY EXPANSION);
+
+# Innodb:error - no result returned (update result of query once fixed) (innodb limit , does not understand character boundry for japanses like charcter set)
+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("+S��v��r +��lpan" IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"������������� �����������"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"query performace"@02' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"�������� ������������"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"��������������������� ���������������"@1' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"��������������������� ���������������"@2' IN BOOLEAN MODE);
+
+ALTER TABLE t1 DROP INDEX idx;
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Innodb:error - no result returned (update result of query once fixed) (innodb limit , does not understand character boundry for japanses like charcter set)
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("��������������������� ���������������");
+# Update fails because where condition do not succeed which is incorrect (update result of query once fixed)
+UPDATE t1 SET a = "Pchn���� w t�� ����d�� je��a" , b = "lub osiem skrzy�� fig" WHERE MATCH(a,b) AGAINST ("��������������������� ���������������");
+UPDATE t1 SET a = "�� ���������� ������ ������-������ ������������? ����", b = "���� ������������������ ������������������! ����" WHERE MATCH(a,b) AGAINST ("��������*" IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+S��v��r +��lpan" IN BOOLEAN MODE);
+
+# Innodb error - no result returned
+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("+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;
+DROP TABLE t1;
+
+# This is to test the update operation on FTS indexed and non-indexed
+# column
+CREATE TABLE t1(ID INT PRIMARY KEY,
+		no_fts_field VARCHAR(10),
+		fts_field VARCHAR(10),
+		FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+
+# Update FULLTEXT indexed column, Doc ID will be updated
+UPDATE t1 SET fts_field='anychange' where id = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# Update non-FULLTEXT indexed column, Doc ID stay to be the same
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# Update both FULLTEXT indexed and non-indexed column, Doc ID will be updated
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+
+# FTS index dropped, the DOC_ID column is kept, however, the ID will not
+# change
+DROP INDEX f on t1;
+
+UPDATE t1 SET fts_field='anychange' where id = 1;
+
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+
+CREATE FULLTEXT INDEX f ON t1(FTS_FIELD);
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+
+DROP TABLE t1;
+
+# Test on user supplied 'FTS_DOC_ID'
+CREATE TABLE t1(`FTS_DOC_ID` serial,
+		no_fts_field VARCHAR(10),
+		fts_field VARCHAR(10),
+		FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+
+# Doc ID must be updated as well (HA_FTS_INVALID_DOCID).
+--error 182
+UPDATE t1 SET fts_field='anychange' where FTS_DOC_ID = 1;
+
+UPDATE t1 SET fts_field='anychange', FTS_DOC_ID = 2 where FTS_DOC_ID = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# "BBB" should be marked as deleted.
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# "HA_FTS_INVALID_DOCID"
+--error 182
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where FTS_DOC_ID = 2;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+
+# Doc ID must be monotonically increase (HA_FTS_INVALID_DOCID)
+--error 182
+UPDATE t1 SET  FTS_DOC_ID = 1 where FTS_DOC_ID = 2;
+
+DROP INDEX f ON t1;
+
+# After FULLTEXT index dropped, we can update the fields freely
+UPDATE t1 SET fts_field='newchange' where FTS_DOC_ID = 2;
+
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1(ID INT PRIMARY KEY,
+		no_fts_field VARCHAR(10),
+		fts_field VARCHAR(10),
+		FULLTEXT INDEX f(fts_field), index k(fts_field)) ENGINE=INNODB;
+
+CREATE TABLE t2(ID INT PRIMARY KEY,
+		no_fts_field VARCHAR(10),
+		fts_field VARCHAR(10),
+		FULLTEXT INDEX f(fts_field),
+		INDEX k2(fts_field),
+		FOREIGN KEY(fts_field) REFERENCES
+		t1(fts_field) ON UPDATE CASCADE) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+
+INSERT INTO t2 VALUES (1, 'AAA', 'BBB');
+
+update t1 set fts_field='newchange' where id =1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("BBB");
+SELECT * FROM t1 WHERE MATCH(fts_field) against("newchange");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("newchange");
+
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+# Testcases adopted from innodb_multi_update.test
+
+CREATE TABLE t1(id INT PRIMARY KEY,
+		fts_field VARCHAR(10),
+		FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+
+CREATE TABLE t2(id INT PRIMARY KEY,
+		fts_field VARCHAR(10),
+		FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+INSERT INTO t1 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800'),(9,'900'),(10,'1000'),(11,'1100'),(12,'1200');
+INSERT INTO t2 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800');
+
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo');
+
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo') WHERE t1.fts_field = "100foo";
+
+# Update two tables in the same statement
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'xoo'), t2.fts_field = CONCAT(t1.fts_field, 'xoo') where t1.fts_field=CONCAT(t2.fts_field, 'foo');
+
+# Following selects shows whether the correct Doc ID are updated
+
+# This row should present in table t1
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foofoo");
+
+# Following rows should be dropped
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foo");
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100");
+
+# This row should present in table t2
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400fooxoo");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("100");
+
+# Follow rows should be marked as dropped
+SELECT * FROM t2 WHERE MATCH(fts_field) against("200");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400");
+
+
+DROP TABLE t1;
+
+DROP TABLE t2;
+
+
+--echo
+--echo BUG#13701973/64274: MYSQL THREAD WAS SUSPENDED WHEN EXECUTE UPDATE QUERY
+--echo
+# FTS setup did not track which tables it had already looked at to see whether
+# they need initialization. Hilarity ensued when hitting circular dependencies.
+
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
+
+CREATE TABLE t1 (
+  t1_id INT(10) UNSIGNED NOT NULL,
+  t2_id INT(10) UNSIGNED DEFAULT NULL,
+  PRIMARY KEY (t1_id),
+  FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+    ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+  t1_id INT(10) UNSIGNED NOT NULL,
+  t2_id INT(10) UNSIGNED NOT NULL,
+  t3_id INT(10) UNSIGNED NOT NULL,
+  t4_id INT(10) UNSIGNED NOT NULL,
+  PRIMARY KEY (t2_id),
+  FOREIGN KEY (t1_id) REFERENCES t1 (t1_id),
+  FOREIGN KEY (t3_id) REFERENCES t3 (t3_id)
+    ON DELETE CASCADE ON UPDATE CASCADE,
+  FOREIGN KEY (t4_id) REFERENCES t4 (t4_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t3 (
+  t3_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+  payload char(3),
+  PRIMARY KEY (t3_id)
+) ENGINE=InnoDB;
+
+INSERT INTO t3 VALUES (1, '100');
+
+CREATE TABLE t4 (
+  t2_id INT(10) UNSIGNED DEFAULT NULL,
+  t4_id INT(10) UNSIGNED NOT NULL,
+  PRIMARY KEY (t4_id),
+  FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+    ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+SET FOREIGN_KEY_CHECKS=1;
+
+UPDATE t3 SET payload='101' WHERE t3_id=1;
+
+SET FOREIGN_KEY_CHECKS=0;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_misc_debug.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_debug.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_debug.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,209 @@
+#------------------------------------------------------------------------------
+# Misc FTS test on debug servers only
+#------------------------------------------------------------------------------
+--source include/have_innodb.inc
+
+# Must have debug code to use SET SESSION debug
+--source include/have_debug.inc
+
+# Valgrind would complain about memory leaks when we crash on purpose.
+--source include/not_valgrind.inc
+
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
+
+# Following are test for crash recovery on FTS index, the first scenario
+# is for bug Bug #14586855 INNODB: FAILING ASSERTION: (DICT_INDEX_GET_N_UNIQUE(
+# PLAN->INDEX) <= PLAN->N_EXAC
+
+# Scenario 1: Hidden FTS_DOC_ID column, and FTS index dropped
+# Create FTS table
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+# Drop the FTS index before more insertion. The FTS_DOC_ID should
+# be kept
+DROP INDEX title ON articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+BEGIN;
+
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+# Request a crash on next execution of commit.
+SET SESSION debug="+d,crash_commit_before";
+#
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+#
+# Execute the statement that causes the crash.
+--error 2013
+COMMIT;
+
+--source include/wait_until_disconnected.inc
+--sleep 2
+
+# Turn on reconnect
+--enable_reconnect
+#
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+#
+# Turn off reconnect again
+--disable_reconnect
+
+# This insert will re-initialize the Doc ID counter, it should not crash
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+# Recreate fulltext index to see if everything is OK
+CREATE FULLTEXT INDEX idx ON articles (title,body);
+
+# Should return 3 rows
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+# Scenario 2: Hidden FTS_DOC_ID column, with FTS index
+# Now let's do more insertion and test a crash with FTS on
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...'),
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# Now let's crash the server with "crash_commit_before"
+BEGIN;
+
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+# Request a crash on next execution of commit.
+SET SESSION debug="+d,crash_commit_before";
+#
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+#
+# Execute the statement that causes the crash.
+--error 2013
+COMMIT;
+
+--source include/wait_until_disconnected.inc
+--sleep 2
+
+# Turn on reconnect
+--enable_reconnect
+#
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+#
+# Turn off reconnect again
+--disable_reconnect
+
+# This insert will re-initialize the Doc ID counter, it should not crash
+INSERT INTO articles (title,body) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+# Should return 6 rows
+SELECT * FROM articles
+        WHERE MATCH (title,body)
+        AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Scenario 3: explicit FTS_DOC_ID column with FTS index 
+# Now let's test user defined FTS_DOC_ID
+
+CREATE TABLE articles (
+	id int PRIMARY KEY,
+        FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+        title VARCHAR(200),
+        body TEXT
+        ) ENGINE=InnoDB;
+
+CREATE FULLTEXT INDEX idx1 on articles (title, body);
+
+# Note the FTS_DOC_ID is not fully ordered with primary index
+INSERT INTO articles VALUES
+        (1, 10, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        (2, 1, 'How To Use MySQL Well','After you went through a ...'),
+        (3, 2, 'Optimizing MySQL','In this tutorial we will show ...'),
+        (4, 11, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        (5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'),
+        (7, 4, 'MySQL Security','When configured properly, MySQL ...');
+
+# Now let's crash the server with "crash_commit_before"
+BEGIN;
+
+INSERT INTO articles VALUES
+        (100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
+
+# Request a crash on next execution of commit.
+SET SESSION debug="+d,crash_commit_before";
+#
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+#
+# Execute the statement that causes the crash.
+--error 2013
+COMMIT;
+
+--source include/wait_until_disconnected.inc
+--sleep 2
+
+# Turn on reconnect
+--enable_reconnect
+#
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+#
+
+# This would re-initialize the FTS index and do the re-tokenization
+# of above records
+INSERT INTO articles VALUES         (8, 12, 'MySQL Tutorial','DBMS stands for DataBase ...');
+
+SELECT * FROM articles WHERE MATCH (title, body)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE(
+# TABLE->FTS->INDEXES, ALTER TABLE
+CREATE TABLE articles (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        title VARCHAR(200),
+        body TEXT,
+        FULLTEXT (title,body)
+        ) ENGINE=InnoDB;
+
+# Abort the operation in dict_create_index_step by setting
+# return status of dict_create_index_tree_step() to DB_OUT_OF_MEMORY
+# The newly create dict_index_t should be removed from fts cache
+SET SESSION debug="+d,ib_dict_create_index_tree_fail";
+--error ER_OUT_OF_RESOURCES
+CREATE FULLTEXT INDEX idx ON articles(body);
+SET SESSION debug="-d,ib_dict_create_index_tree_fail";
+
+# This simply go through ha_innobase::commit_inplace_alter_table
+# and do a fts_check_cached_index()
+ALTER TABLE articles STATS_PERSISTENT=DEFAULT;
+
+DROP TABLE articles;

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,172 @@
+#------------------------------------------------------------------------------
+# Test With two FTS index on same table + alter/create/drop index + tnx
+#------------------------------------------------------------------------------
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB STATS_PERSISTENT=0;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the 2 FTS index Using Alter on same table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_1 (a);
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_2 (b);
+EVAL SHOW CREATE TABLE t1;
+
+# check mutiple index with transaction
+START TRANSACTION;
+# Insert rows
+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 ...');
+ROLLBACK;
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE MATCH (a)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select * from t1 where MATCH(a) AGAINST("+mysql +Tutorial" IN BOOLEAN MODE);
+select * from t1 where MATCH(b) AGAINST("+Tutorial" IN BOOLEAN MODE);
+select * from t1 where MATCH(b) AGAINST("+stands +(DataBase)" IN BOOLEAN MODE);
+select * from t1 where MATCH(b) AGAINST("+DataBase -(comparison)" IN BOOLEAN MODE);
+select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1;
+select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select * from t1 where MATCH a AGAINST ("+Optimiz* +Optimiz*" IN BOOLEAN MODE);
+select * from t1 where MATCH b AGAINST ('"DBMS stands"' IN BOOLEAN MODE);
+select * from t1 where MATCH b AGAINST ('"DBMS STANDS"' IN BOOLEAN MODE);
+
+# query expansion
+select * from t1 where MATCH(b) AGAINST ("DataBase" WITH QUERY EXPANSION);
+select * from t1 where MATCH(a) AGAINST ("Security" WITH QUERY EXPANSION);
+
+# Drop index 
+ALTER TABLE t1 DROP INDEX idx_1;
+ALTER TABLE t1 DROP INDEX idx_2;
+
+# Create the FTS index again
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_1 (a);
+ALTER TABLE t1 ADD FULLTEXT INDEX idx_2 (b);
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE MATCH (a)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select * from t1 where MATCH(a) AGAINST("+mysql +Tutorial" IN BOOLEAN MODE);
+select * from t1 where MATCH(b) AGAINST("+Tutorial" IN BOOLEAN MODE);
+select * from t1 where MATCH(b) AGAINST("+stands +(DataBase)" IN BOOLEAN MODE);
+select * from t1 where MATCH(b) AGAINST("+DataBase -(comparison)" IN BOOLEAN MODE);
+select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1;
+select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select * from t1 where MATCH a AGAINST ("+Optimiz* +Optimiz*" IN BOOLEAN MODE);
+select * from t1 where MATCH b AGAINST ('"DBMS stands"' IN BOOLEAN MODE);
+select * from t1 where MATCH b AGAINST ('"DBMS STANDS"' IN BOOLEAN MODE);
+
+# query expansion
+select * from t1 where MATCH(b) AGAINST ("DataBase" WITH QUERY EXPANSION);
+select * from t1 where MATCH(a) AGAINST ("Security" WITH QUERY EXPANSION);
+
+# insert for proximity search 
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test proximity fts search, test, proximity and phrase',
+         'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+        ('test more of proximity for fts search, test, more proximity and phrase',
+         'search, with proximity innodb');
+
+# This should only return the first document
+SELECT * FROM t1
+        WHERE MATCH (a)
+        AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT * FROM t1
+        WHERE MATCH (a)
+        AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT * FROM t1
+        WHERE MATCH (b)
+        AGAINST ('"proximity innodb"@4' IN BOOLEAN MODE);
+
+# Similar boundary testing for the words
+SELECT * FROM t1
+        WHERE MATCH (a)
+        AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT * FROM t1
+        WHERE MATCH (a)
+        AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a)
+        AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT * FROM t1
+        WHERE MATCH (a)
+        AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE);
+
+
+# Select word "tutorial" in the table - innodb crash
+SELECT * FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 WHERE
+MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+) OR t1.id = 3 ;
+
+
+# Select word "tutorial" in the table  - innodb crash
+SELECT * FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2
+WHERE MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t2.id != 3) ;
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE
+MATCH (b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+
+# Select word except  "tutorial" in the table
+SELECT * FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1
+WHERE MATCH (b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ;
+
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+
+
+# Select not word like "tutorial" using subquery
+SELECT * FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+
+
+SELECT * FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a) AGAINST ('"proximity search"@3' IN BOOLEAN MODE));
+SELECT * FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.b) AGAINST ('"proximity innodb"@3' IN BOOLEAN MODE));
+
+DROP TABLE t1;
+

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_opt.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_opt.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_opt.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,539 @@
+#  
+# Tests for optimizations for InnoDB fulltext search (WL#6043)
+#
+
+CREATE TABLE wp(
+  FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+  title VARCHAR(255) NOT NULL DEFAULT '',
+  text MEDIUMTEXT NOT NULL,
+  dummy INTEGER,
+  PRIMARY KEY (FTS_DOC_ID),
+  UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+  FULLTEXT KEY idx (title,text) 
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;  
+
+INSERT INTO wp (title, text) 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','1. Never run mysqld as root. 2. ...'),
+  ('MySQL vs. YourSQL','In the following database to database comparison ...'),
+  ('MySQL Security','When configured properly, MySQL ...');      
+
+CREATE TABLE t1 (i INTEGER);
+INSERT INTO t1 SELECT FTS_DOC_ID FROM wp;
+
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE wp;
+-- enable_result_log
+
+#
+#  Show results of MATCH expressions for reference
+#
+SELECT FTS_DOC_ID, title, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp;
+
+#
+# Test that filesort is not used if ordering on same match expression
+# as where clause
+#
+--echo No sorting for this query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No sorting for this query even if MATCH is part of an expression
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') > 0.1
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No sorting even if there are several MATCH expressions as long as the
+--echo right one is used in ORDER BY
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score1 DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo Sorting since it is not a single table query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID = t1.i
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since there is no WHERE clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering on multiple columns
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC, FTS_DOC_ID;
+  
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering is not descending
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score ASC;
+  
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting because one is ordering on a different MATCH expression
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('mysql') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+  
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+#
+#  Tests for ORDER BY/LIMIT optimzation
+#
+--echo No sorting for this query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo Revert to table scan and sorting for this query since not
+--echo enough matching rows to satisfy LIMIT clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 3;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since no LIMIT clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since there is a WHERE clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp
+WHERE dummy IS NULL
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering is not on a simple MATCH expressions
+FLUSH STATUS;
+
+SELECT title, (MATCH(title, text) AGAINST ('database')) * 100 AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+#
+#  Test that there is no row accesses if all necessary information is
+#  available in FTS result
+#
+--echo No ordinary handler accesses when only accessing FTS_DOC_ID and MATCH
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Still no handler accesses when adding FTS_DOC_ID to WHERE clause
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID > 2;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Still no handler accesses when ordering by MATCH expression
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization is disabled when ordering on FTS_DOC_ID
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY 1 DESC;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization also work with several MATCH expressions
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization does not apply if sorting on a different MATCH expressions
+--echo from the one used to access the 
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score2 DESC;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+FLUSH STATUS;
+
+--echo Optimization does not apply for GROUP BY
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') AS score
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+GROUP BY score;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+#
+#  Putting all three optimizations together
+#
+--echo No sorting and no table access with LIMIT clause and only information
+--echo from FTS result
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+#
+# Count optimization
+#
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo If count optimization applies, EXPLAIN shows 
+--echo "Select tables optimized away."
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+--echo Verify that there was no table access
+SHOW STATUS LIKE 'Handler_read%';
+
+let $query = 
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo Optimization applies also to COUNT(expr) as long as expr is not nullable
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT count(*)
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database');
+
+--echo Optimization does not apply if not a single table query.
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+
+--echo Optimization does not apply if MATCH is part of an expression
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+
+--echo Optimization does not apply if MATCH is part of an expression
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT COUNT(dummy) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo Optimization does not apply if COUNT expression is nullable
+eval EXPLAIN $query;
+eval $query;
+
+#
+#  Verify that the queries optimized for InnoDB works with QUERY EXPANSION
+#
+
+# Query will also avoid sorting when query expansion is used
+FLUSH STATUS;
+SELECT title, 
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+#
+#  Verify that the queries optimized for InnoDB works with BOOLEAN MODE
+#
+
+# Query will also avoid sorting when Boolean mode is used
+FLUSH STATUS;
+SELECT title, 
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+
+#
+#  Verify that the queries optimized for InnoDB works with 
+#  BOOLEAN proximity search
+#
+
+# Query will also avoid sorting when Boolean mode is used
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query =
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+#
+# Check that nothing goes wrong when combining different modes
+#
+SELECT title,
+       MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+
+SELECT title,
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('MySQL database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+
+SELECT title,
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC;
+
+
+#
+#  Verify that the queries optimized for InnoDB still works with MyISAM
+#
+ALTER TABLE wp ENGINE=myisam;
+
+# Check avoid sorting query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+
+DROP TABLE wp, t1;
+
+

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,261 @@
+# This is the DDL function tests for innodb FTS
+# Functional testing with FTS proximity search using '@'
+# and try search default words
+
+--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
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE= InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+# Try to Search default stopword from innodb, "where", "will", "what"
+# and "when" are all stopwords
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("where will");
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("when");
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("what" WITH QUERY EXPANSION);
+
+# boolean No result expected
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+
+# no result expected. Words are filtered out as stopwords
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"where will"@6' IN BOOLEAN MODE);
+
+# no result expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+# insert record with @ character which is used in proximity search
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','request docteam at oraclehelp.com ...')  ,
+        ('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...')  ,
+        ('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+# proximity search with @ charcter
+
+# We don't need more than one word in proximity search. Single word
+# treated as single word search
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"request"@10' IN BOOLEAN MODE);
+
+# If the distance is 0, it is treated as "phrase search"
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"Trial version"@0' IN BOOLEAN MODE);
+
+# @ is word seperator
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"request docteam at oraclehelp.com"@10' IN BOOLEAN MODE);
+
+# This should not return any document
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"1255 minute"@1' IN BOOLEAN MODE);
+
+# This should return the first document. That is "1255" and "minutes" are
+# in a two-word range (adjacent)
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"1255 minute"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"1255"@10' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('1255' WITH QUERY EXPANSION);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"request docteam"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"1255 minute"' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request docteam at oraclehelp.com');
+
+# Test across fields search
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+	AGAINST ('"MySQL request"@3' IN BOOLEAN MODE);
+
+# Two words are in 10 words range
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+	AGAINST ('"Trial memory"@10' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+	AGAINST ('"Trial memory"@9' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+# test on utf8 encoded proximity search
+CREATE TABLE t1 (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	a VARCHAR(200),
+	b TEXT
+	) CHARACTER SET = UTF8, ENGINE= InnoDB;
+
+INSERT INTO t1 (a,b) VALUES
+	('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+	('when To Use MySQL Well','After that you went through a ...'),
+	('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+INSERT INTO t1 (a,b) VALUES
+	('MySQL Tutorial','request docteam at oraclehelp.com ...')  ,
+	('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...'),
+	('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+
+# Should have 2 rows. Note proximity search does require words in order
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"mysql use"@2' IN BOOLEAN MODE);
+
+# Should return 0 row
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"mysql use"@1' IN BOOLEAN MODE);
+
+INSERT INTO t1 (a,b) VALUES   ('XYZ, long blob', repeat("a", 9000));
+
+INSERT INTO t1 (a,b) VALUES   (repeat("b", 9000), 'XYZ, long blob');
+
+# 2 rows match
+SELECT count(*) FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"xyz blob"@3' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+set global innodb_file_format="Barracuda";
+set global innodb_file_per_table=1;
+
+# Test fts with externally stored long column
+CREATE TABLE t1 (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	a TEXT,
+	b TEXT,
+	c TEXT
+	) CHARACTER SET = UTF8, ROW_FORMAT=DYNAMIC, ENGINE= InnoDB;
+
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, long text', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, very little long blob very much blob', 'very long blob');
+
+# Note ������ is count as one word
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000),"very ������ ��� blob","new ������������information");
+CREATE FULLTEXT INDEX idx on t1 (a,b,c);
+
+INSERT INTO t1 (a,b,c) VALUES   (repeat("x", 19000), 'new, long text', 'very new blob');
+INSERT INTO t1 (a,b,c) VALUES   ('interesting, long text', repeat("x", 19000), 'very very good new blob');
+
+# 3 rows should match
+SELECT count(*) FROM t1
+        WHERE MATCH (a,b,c)
+        AGAINST ('"very blob"@3' IN BOOLEAN MODE);
+
+SELECT count(*) FROM t1
+        WHERE MATCH (a,b,c)
+        AGAINST ('"very long blob"@0' IN BOOLEAN MODE);
+
+# 4 rows should match
+SELECT count(*) FROM t1
+        WHERE MATCH (a,b,c)
+        AGAINST ('"very blob"@4' IN BOOLEAN MODE);
+
+# 1 row should match
+SELECT count(*) FROM t1
+         WHERE MATCH (a,b,c)
+         AGAINST ('"interesting blob"@9' IN BOOLEAN MODE);
+
+# should have 3 rows
+SELECT COUNT(*) FROM t1
+	 WHERE MATCH (a,b,c)
+	 AGAINST ('"interesting blob"@9  "very long blob"@0' IN BOOLEAN MODE);
+
+# should have 3 rows
+SELECT COUNT(*) FROM t1
+         WHERE MATCH (a,b,c)
+         AGAINST ('"very blob"@4 - "interesting blob"@9' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	a VARCHAR(200),
+	b TEXT
+	) CHARACTER SET = UTF8, ENGINE= InnoDB;
+
+# Space and special characters are not counted as word
+INSERT INTO t1 (a,b) VALUES
+	('MySQL from Tutorial','DBMS stands for    + DataBase ...');
+
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"stands database"@3' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+# Test fts with externally stored long column
+CREATE TABLE t1 (
+	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+	a TEXT,
+	b TEXT,
+	c TEXT
+	) CHARACTER SET = UTF8, ROW_FORMAT=DYNAMIC, ENGINE= InnoDB;
+
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, long text', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   ('XYZ, ������ very little long blob very much blob', repeat("b", 19000), 'very long but smaller blob');
+
+CREATE FULLTEXT INDEX idx on t1 (a,b,c);
+
+DELETE FROM t1;
+
+INSERT INTO t1 (a,b,c) VALUES   (repeat("b", 19000), 'XYZ, long text', 'very long blob');
+INSERT INTO t1 (a,b,c) VALUES   ('XYZ, ������ very little long blob is a very much longer blob', repeat("b", 19000), 'this is very long but smaller blob');
+
+SELECT count(*) FROM t1
+        WHERE MATCH (a,b,c)
+        AGAINST ('"very blob"@4' IN BOOLEAN MODE);
+
+SELECT count(*) FROM t1
+        WHERE MATCH (a,b,c)
+        AGAINST ('"very blob"@3' IN BOOLEAN MODE);
+
+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;

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test	2013-08-07 09:55:00 +0000
@@ -0,0 +1,1040 @@
+# FTS index with transaction
+# Important Note:
+# 1) Uncommitted records are not visible using FTS index - this is by FTS design
+# 2) records will be seen using FTS index ONLY when transaction completes 
+# 3) UNCOMMITTED RECORDS CAN BE SEEN WITH QURIES WHICH DO NOT USE FTS INDEX
+# this behavior do not break integratity of tables and "select" which do not use FTS still can view them.
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#------------------------------------------------------------------------------
+# FTS with transaction
+#------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB STATS_PERSISTENT=0;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+START TRANSACTION;
+
+# this record is NOT seen with queries using FTS index until commit 
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','request docteam for oraclehelp.');
+
+# first and third record expected 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+# no records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request' IN NATURAL LANGUAGE MODE);
+
+# all records with MySQL expected but record with 'request' not
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request MySQL' IN BOOLEAN MODE);
+
+# all records with MySQL expected but record with 'request' not
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('-request +MySQL' IN BOOLEAN MODE);
+
+# only 2nd record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE);
+
+# one record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"stands Database"@11' IN BOOLEAN MODE) ORDER BY 1;
+
+# all records expected except with 'request' 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION);
+
+# transaction commit ,now we will be able to see records with FTS index
+COMMIT;
+
+# records having tutorial word
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+# records having tutorial and MySQL word
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request MySQL' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION);
+
+START TRANSACTION;
+
+# insert null values
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+
+# one record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+# update record which is visible with FTS index as transaction completed
+UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...'
+WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+# no records expected as it is updated with new value
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request');
+
+# no records expected as update tnx is not committed yet.
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('query performace' IN BOOLEAN MODE);
+
+# update will not able to find record as it uses FTS , so record will be updated
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq  xyz.com ...'
+WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE);
+
+# no records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('performace');
+# no records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+COMMIT;
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1;
+
+# insert record with @ character which is used in proximity search
+INSERT INTO t1 (a,b) VALUES
+        ('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...')  ,
+        ('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+#------------------------------------------------------------------------------
+# FTS with rollback
+#------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+START TRANSACTION;
+
+# insert record but it won't be visible using FTS index until tnx completes.
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','request docteam for oraclehelp.');
+# two records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+# no records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request' IN NATURAL LANGUAGE MODE);
+# only records with MySQL expected as record with 'request' word not committed yet.
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request MySQL' IN BOOLEAN MODE);
+
+# records with MySQL word
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('-request +MySQL' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE);
+
+# query expansion mode 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION);
+
+# query expansion mode 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION);
+
+# rollback transaction , record with 'request' word rollbacked.
+ROLLBACK;
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request MySQL' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION);
+
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+
+# no update as record with where condition is not present
+UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...'
+WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+# no records
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request');
+
+# no records
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('query performace' IN BOOLEAN MODE);
+
+# no update as record with where condition is not present
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq  xyz.com ...'
+WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE);
+
+# no records
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('performace');
+
+# no records
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+ROLLBACK;
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1;
+
+# insert record with @ character which is used in proximity search
+INSERT INTO t1 (a,b) VALUES
+        ('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...')  ,
+        ('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#------------------------------------------------------------------------------
+# FTS with transaction - 
+# Uncommitted records are visible using FTS index so try use normal query to 
+# update such records in active transaction
+#------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','request docteam for oraclehelp.');
+
+START TRANSACTION;
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+
+# only one record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+# update record
+UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...' WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+# updated record is visible as we do not use FTS index in following query
+SELECT * from t1;
+
+# no records expected as it is updated with new value
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request');
+
+# no record expected as transaction is not committed.
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('query performace' IN BOOLEAN MODE);
+
+# following update will not succeed as it uses FTS index in where clause and the record matching condition is not committe yet.
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq mail xyz.com ...' WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE);
+# update will succeed as it uses non FTS condition in where clause. Record in where clause is visible as it is accessed by NON FTS condition.
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq mail xyz.com ...' WHERE b like '%query performace%';
+
+# no record expected as it is updated wih new value
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('performace');
+
+# not visible with FTS as transaction not committed.
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+
+SELECT * from t1;
+COMMIT;
+SELECT * from t1;
+
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE);
+SELECT * FROM t1;
+
+# insert record with @ character which is used in proximity search
+INSERT INTO t1 (a,b) VALUES
+        ('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...')  ,
+        ('when To Use MySQL Well','for free faq  mail at xyz.com ...');
+
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#------------------------------------------------------------------------------
+# FTS with transaction - multiple connections
+#------------------------------------------------------------------------------
+
+#set names utf8;
+SET NAMES UTF8;
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = UTF8,ENGINE = InnoDB;
+
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SET NAMES UTF8;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+        ('�� �������� �������� ������������', '������ ������ M���� ������������'),
+        ('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+        ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+SET NAMES UTF8;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+
+--echo "In connection 1"
+--connection con1
+
+# first and third record expected 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' IN NATURAL LANGUAGE MODE);
+
+INSERT INTO t1 (a,b) VALUES
+        ('adding record using session 1','for verifying multiple concurrent transactions'),
+        ('�������� ���� ���� ������������', '���� M���� ���� ����������');
+
+# one records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+������������� +���������*' IN BOOLEAN MODE);
+
+START TRANSACTION;
+
+# this record is NOT seen with queries using FTS index until commit 
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','request docteam for oraclehelp.'),
+        ('P����li�� ��lu��ou��k�� k����', '��p��l ����belsk�� k��dy');
+
+# no records expected as its not committed yet
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request ����belsk��' IN BOOLEAN MODE);
+
+# 3 record expected 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY 1;
+
+# one record expected proximity
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+
+--echo "In connection 2"
+--connection con2
+
+# one records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+record +multiple' IN BOOLEAN MODE);
+
+# 3 rcords expected , two for tutor* and one for S��v��*
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutor* S��v��*' IN BOOLEAN MODE) ORDER BY 1;
+
+
+# one record expected 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('usin* multipl*' IN BOOLEAN MODE);
+
+# no record expected as this record is not committed
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"request docteam"@08' IN BOOLEAN MODE);
+
+# no records expected as this record is not committed
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request' IN NATURAL LANGUAGE MODE);
+
+# all records with MySQL expected but record with 'request' is not committed so 'request' string not visible
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request MySQL' IN BOOLEAN MODE);
+
+# all records with MySQL expected but record with 'request' not
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('-request +MySQL' IN BOOLEAN MODE);
+
+# only one record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE);
+
+# one record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('"stands Database"@11' IN BOOLEAN MODE) ORDER BY 1;
+
+# all records expected except with 'request' 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY 1;
+
+--echo "In connection 1"
+--connection con1
+# transaction commit ,now we will be able to see records with FTS index
+COMMIT;
+# records with MySQL,request string expected 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('P����li�� ��lu��ou��k��' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('P����li��');
+
+# insert null values
+INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+SELECT * FROM t1 WHERE a IS NULL AND b IS NULL;
+
+--echo "In connection 2"
+--connection con2
+
+# one record expected 
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('usin* multipl*' IN BOOLEAN MODE);
+
+# one record expected , b/c record is committed in connection 1
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE a IS NULL AND b IS NULL;
+
+
+
+ALTER TABLE t1 DROP INDEX idx;
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+START TRANSACTION;
+# update record but do not commiit so latest upadted string not visible using FTS index but available with normal select
+UPDATE t1 SET a = 'Trial version P����li�� ��lu��ou��k��' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...'
+WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE);
+
+# no records expected as it is updated with new value
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request');
+
+# no records expected as it is not committed
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+query +performace' IN BOOLEAN MODE);
+
+# only one record will be updated as other is not committed hence not seen using FTS
+UPDATE t1 SET a = UPPER(a) WHERE MATCH (a,b) AGAINST ('+P����li�� +��lu��ou��k��' IN BOOLEAN MODE);
+
+# no records expected as it is not committed
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+P����li�� +��lu��ou��k��' IN BOOLEAN MODE);
+
+UPDATE t1 SET a = UPPER(a) WHERE a LIKE '%version P����li��%';
+
+# no records expected as it is not committed
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+query +performace' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE b LIKE '%query performace%';
+
+# no records expected as it is updated with new value
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('request');
+
+--echo "In connection 1"
+--connection con1
+
+# no records expected as update tnx is not committed yet.
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('query performace' IN BOOLEAN MODE);
+
+# no records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('performace');
+# no records expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+mail +MySQL' IN BOOLEAN MODE);
+
+--echo "In connection 2"
+--connection con2
+COMMIT;
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+query +performace' IN BOOLEAN MODE);
+
+
+
+--echo "In connection 1"
+--connection con1
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('+query +performace' IN BOOLEAN MODE);
+# Update
+UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq  xyz.com ...'
+WHERE MATCH (a,b) AGAINST ('+�������� +������������' IN BOOLEAN MODE);
+# one record expected
+SELECT * FROM t1
+        WHERE MATCH (a,b)
+        AGAINST ('well free') ORDER BY 1;
+
+--disconnect con1
+--disconnect con2
+--source include/wait_until_disconnected.inc
+
+--connection default
+DROP TABLE t1;
+
+
+#------------------------------------------------------------------------------
+# FTS with delete transaction with multiple session 
+#------------------------------------------------------------------------------
+
+SET NAMES UTF8;
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = UTF8,ENGINE = InnoDB;
+
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SET NAMES UTF8;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+        ('�� �������� �������� ������������', '������ ������ M���� ������������'),
+        ('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+        ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+SET NAMES UTF8;
+select @@session.tx_isolation;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+        ('adding record using session 1','for verifying multiple concurrent transactions'),
+        ('�������� ���� ���� ������������', '���� M���� ���� ����������');
+
+
+--echo "In connection 1"
+--connection con1
+
+
+SELECT * FROM t1;
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+# Delete rows
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# No record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+--echo "In connection 2"
+--connection con2
+# records expected due to repeatable read 
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+
+SELECT * FROM t1;
+
+--echo "In connection 1"
+--connection con1
+COMMIT;
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# No record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+--echo "In connection 2"
+--connection con2
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# No record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+
+--disconnect con1
+--disconnect con2
+--source include/wait_until_disconnected.inc
+
+--connection default
+DROP TABLE t1;
+
+
+
+#------------------------------------------------------------------------------
+# FTS with update transaction with multiple session 
+#------------------------------------------------------------------------------
+
+SET NAMES UTF8;
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = UTF8,ENGINE = InnoDB;
+
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SET NAMES UTF8;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+        ('�� �������� �������� ������������', '������ ������ M���� ������������');
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+SET NAMES UTF8;
+select @@session.tx_isolation;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+        ('adding record using session 1','for verifying multiple concurrent transactions'),
+        ('�������� ���� ���� ������������', '���� M���� ���� ����������');
+
+
+--echo "In connection 1"
+--connection con1
+
+
+SELECT * FROM t1;
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+# Update row
+UPDATE t1 SET a =  '����������� ����� ������ ����������������' , b = '������������� ����������� ����� �������� ������������' WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+# Insert row
+INSERT INTO t1(a,b) VALUES ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+
+SELECT * FROM t1;
+
+# 1 record expected - records not seen
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected - records not seen
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+--echo "In connection 2"
+--connection con2
+# 2 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# no records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+
+# 2 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+--echo "In connection 1"
+--connection con1
+COMMIT;
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# no record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+--echo "In connection 2"
+--connection con2
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# Innodb:error no record expected 
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+
+--disconnect con1
+--disconnect con2
+--source include/wait_until_disconnected.inc
+
+--connection default
+DROP TABLE t1;
+
+
+#------------------------------------------------------------------------------
+# FTS with delete/rollback transaction with multiple session 
+#------------------------------------------------------------------------------
+
+SET NAMES UTF8;
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = UTF8,ENGINE = InnoDB;
+
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SET NAMES UTF8;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+        ('�� �������� �������� ������������', '������ ������ M���� ������������'),
+        ('����������� ����� ������ ����������������' ,'������������� ����������� ����� �������� ������������'),
+        ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+SET NAMES UTF8;
+select @@session.tx_isolation;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+        ('adding record using session 1','for verifying multiple concurrent transactions'),
+        ('�������� ���� ���� ������������', '���� M���� ���� ����������');
+
+
+--echo "In connection 1"
+--connection con1
+
+
+SELECT * FROM t1;
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+# Delete rows
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# No record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# No record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+--echo "In connection 2"
+--connection con2
+# records expected due to repeatable read 
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+
+SELECT * FROM t1;
+
+--echo "In connection 1"
+--connection con1
+ROLLBACK;
+# 2 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+--echo "In connection 2"
+--connection con2
+# 2 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+
+--disconnect con1
+--disconnect con2
+--source include/wait_until_disconnected.inc
+
+--connection default
+DROP TABLE t1;
+
+
+
+#------------------------------------------------------------------------------
+# FTS with update/rollback transaction with multiple session 
+#------------------------------------------------------------------------------
+
+SET NAMES UTF8;
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) CHARACTER SET = UTF8,ENGINE = InnoDB;
+
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SET NAMES UTF8;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL from Tutorial','DBMS stands for DataBase ...')  ,
+        ('when To Use MySQL Well','After that you went through a ...'),
+        ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+        ('�� �������� �������� ������������', '������ ������ M���� ������������');
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+SET NAMES UTF8;
+select @@session.tx_isolation;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+        ('adding record using session 1','for verifying multiple concurrent transactions'),
+        ('�������� ���� ���� ������������', '���� M���� ���� ����������');
+
+
+--echo "In connection 1"
+--connection con1
+
+
+SELECT * FROM t1;
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+# Update row
+UPDATE t1 SET a =  '����������� ����� ������ ����������������' , b = '������������� ����������� ����� �������� ������������' WHERE MATCH (a,b) AGAINST ('+�������� +M����' IN BOOLEAN MODE);
+# Insert row
+INSERT INTO t1(a,b) VALUES ('S��v��r gr��t', '����an ��v�� ��lpan var ��n��t');
+
+SELECT * FROM t1;
+
+# 1 record expected - records not seen
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+--echo "In connection 2"
+--connection con2
+# 2 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+
+# 2 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# 1 records expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+--echo "In connection 1"
+--connection con1
+ROLLBACK;
+# 2 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# no record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+--echo "In connection 2"
+--connection con2
+# 2 record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+M����' IN BOOLEAN MODE);
+# 1 record expected 
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('������������');
+# no record expected
+SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"S��v��r gr��t"@18' IN BOOLEAN MODE);
+
+SELECT * FROM t1;
+
+
+--disconnect con1
+--disconnect con2
+--source include/wait_until_disconnected.inc
+
+
+--connection default
+DROP TABLE t1;



More information about the commits mailing list