mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.6 into 10.7
This commit is contained in:
@@ -5,12 +5,6 @@ body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table
|
||||
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 ...'),
|
||||
|
@@ -1,761 +0,0 @@
|
||||
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...
|
||||
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...');
|
||||
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...
|
||||
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;
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
ANALYZE TABLE articles;
|
||||
Table Op Msg_type Msg_text
|
||||
test.articles analyze status Engine-independent statistics collected
|
||||
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
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);
|
||||
connection con1;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
1
|
||||
ANALYZE TABLE articles;
|
||||
Table Op Msg_type Msg_text
|
||||
test.articles analyze status Engine-independent statistics collected
|
||||
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
|
||||
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
|
||||
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
|
||||
connection con1;
|
||||
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
|
||||
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
|
||||
connection con1;
|
||||
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
|
||||
disconnect con1;
|
||||
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;
|
192
mysql-test/suite/innodb_fts/r/stopword,vers.rdiff
Normal file
192
mysql-test/suite/innodb_fts/r/stopword,vers.rdiff
Normal file
@@ -0,0 +1,192 @@
|
||||
--- stopword.result
|
||||
+++ stopword,vers.reject
|
||||
@@ -46,7 +46,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
@@ -60,7 +60,7 @@
|
||||
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'
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING 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);
|
||||
@@ -73,7 +73,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles_2 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
SELECT * FROM articles_2 WHERE MATCH (title,body)
|
||||
@@ -88,13 +88,13 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING 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;
|
||||
+create table user_stopword_session(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
insert into user_stopword values("this");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword_session values("session");
|
||||
@@ -104,7 +104,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING 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)
|
||||
@@ -120,7 +120,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING 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)
|
||||
@@ -142,7 +142,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
@@ -151,7 +151,7 @@
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -248,7 +248,7 @@
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
ANALYZE TABLE articles;
|
||||
Table Op Msg_type Msg_text
|
||||
@@ -320,7 +320,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING 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 ...'),
|
||||
@@ -332,9 +332,9 @@
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
-create table server_stopword(value varchar(30)) engine = innodb;
|
||||
+create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into user_stopword values("when"),("where");
|
||||
delete from user_stopword;
|
||||
@@ -419,7 +419,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
@@ -428,7 +428,7 @@
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -440,7 +440,7 @@
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING 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);
|
||||
@@ -466,7 +466,7 @@
|
||||
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;
|
||||
+create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING 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;
|
||||
@@ -530,7 +530,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
@@ -539,7 +539,7 @@
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -656,7 +656,7 @@
|
||||
"In connection 1"
|
||||
connection con1;
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING 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;
|
||||
@@ -674,7 +674,7 @@
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
-create table user_stopword_1(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword_1(value varchar(30)) WITH SYSTEM VERSIONING 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;
|
||||
@@ -702,7 +702,7 @@
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
NULL
|
||||
-create table server_stopword(value varchar(30)) engine = innodb;
|
||||
+create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
@@ -1,3 +1,6 @@
|
||||
SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
|
||||
SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
|
||||
SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
|
||||
select * from information_schema.innodb_ft_default_stopword;
|
||||
@@ -54,9 +57,6 @@ INSERT INTO articles (title,body) VALUES
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
|
||||
SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
|
||||
SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
|
||||
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'
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
@@ -80,6 +80,8 @@ 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("the");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this");
|
||||
CREATE TABLE articles_3 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
@@ -93,6 +95,8 @@ 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 values("this");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword_session values("session");
|
||||
set session innodb_ft_user_stopword_table="test/user_stopword_session";
|
||||
CREATE TABLE articles_4 (
|
||||
@@ -334,6 +338,8 @@ 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("when"),("where");
|
||||
delete from 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);
|
||||
|
695
mysql-test/suite/innodb_fts/r/versioning,prepare.result
Normal file
695
mysql-test/suite/innodb_fts/r/versioning,prepare.result
Normal file
@@ -0,0 +1,695 @@
|
||||
# Upgrade test
|
||||
CREATE TEMPORARY TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)with system versioning 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 ...');
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test query expansion','for database ...');
|
||||
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');
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
|
||||
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 articles2 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)with system versioning ENGINE=InnoDB;
|
||||
INSERT INTO articles2 (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 articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
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'
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/user_stopword";
|
||||
drop index title on articles2;
|
||||
create fulltext index idx on articles2(title, body);
|
||||
insert into articles2 (title, body)
|
||||
values ('test for stopwords','this is it...');
|
||||
insert into user_stopword values("the");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this");
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
ERROR HY000: Index articles is corrupted
|
||||
call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
|
||||
alter table articles force;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
flush tables;
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `title` (`title`,`body`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
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 test query expansion for database ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
COUNT(*)
|
||||
3
|
||||
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
|
||||
3
|
||||
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.2734021842479706
|
||||
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.2734021842479706
|
||||
6 When configured properly, MySQL ... 0
|
||||
7 for database ... 0.2734021842479706
|
||||
8 search, with proximity innodb 0
|
||||
9 search, with proximity innodb 0
|
||||
10 search, with proximity innodb 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
|
||||
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
|
||||
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 test query expansion for database ...
|
||||
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 ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
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
|
||||
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
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR HY000: Table handler out of memory
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
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 ...
|
||||
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 ('(+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 * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
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 - (Security DBMS)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
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 (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
COUNT(*)
|
||||
10
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
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 ...
|
||||
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
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
drop index idx on articles2;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
|
||||
create fulltext index idx on articles2(title, body);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
# Downgrade test
|
||||
alter table articles force;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
flush tables;
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `title` (`title`,`body`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
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 test query expansion for database ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
COUNT(*)
|
||||
3
|
||||
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
|
||||
3
|
||||
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.2734021842479706
|
||||
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.2734021842479706
|
||||
6 When configured properly, MySQL ... 0
|
||||
7 for database ... 0.2734021842479706
|
||||
8 search, with proximity innodb 0
|
||||
9 search, with proximity innodb 0
|
||||
10 search, with proximity innodb 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
|
||||
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
|
||||
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 test query expansion for database ...
|
||||
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 ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
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
|
||||
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
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR HY000: Table handler out of memory
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
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 ...
|
||||
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 ('(+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 * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
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 - (Security DBMS)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
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 (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
COUNT(*)
|
||||
10
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
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 ...
|
||||
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
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
drop index idx on articles2;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
|
||||
create fulltext index idx on articles2(title, body);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
# Cleanup
|
||||
drop tables articles, articles2, user_stopword;
|
||||
set global innodb_ft_server_stopword_table= default;
|
304
mysql-test/suite/innodb_fts/r/versioning.result
Normal file
304
mysql-test/suite/innodb_fts/r/versioning.result
Normal file
@@ -0,0 +1,304 @@
|
||||
# Upgrade test
|
||||
DROP TABLE mysql.innodb_table_stats, mysql.innodb_index_stats;
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
ERROR HY000: Index articles is corrupted
|
||||
call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
|
||||
alter table articles force;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
flush tables;
|
||||
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 DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `title` (`title`,`body`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
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 test query expansion for database ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
COUNT(*)
|
||||
3
|
||||
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
|
||||
3
|
||||
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.2734021842479706
|
||||
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.2734021842479706
|
||||
6 When configured properly, MySQL ... 0
|
||||
7 for database ... 0.2734021842479706
|
||||
8 search, with proximity innodb 0
|
||||
9 search, with proximity innodb 0
|
||||
10 search, with proximity innodb 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
|
||||
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
|
||||
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 test query expansion for database ...
|
||||
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 ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
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
|
||||
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
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR HY000: Table handler out of memory
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
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 ...
|
||||
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 ('(+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 * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
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 - (Security DBMS)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
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 (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
COUNT(*)
|
||||
10
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
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 ...
|
||||
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
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
drop index idx on articles2;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
|
||||
create fulltext index idx on articles2(title, body);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
# Cleanup
|
||||
drop tables articles, articles2, user_stopword;
|
||||
set global innodb_ft_server_stopword_table= default;
|
264
mysql-test/suite/innodb_fts/t/basic.inc
Normal file
264
mysql-test/suite/innodb_fts/t/basic.inc
Normal file
@@ -0,0 +1,264 @@
|
||||
if ($basic_stage == create_table)
|
||||
{
|
||||
# Create FTS table
|
||||
--error ER_INNODB_NO_FT_TEMP_TABLE
|
||||
CREATE TEMPORARY TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--disable_query_log
|
||||
eval CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)$create_options ENGINE=InnoDB;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
if ($basic_stage == insert_1)
|
||||
{
|
||||
# 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 ...');
|
||||
}
|
||||
|
||||
if ($basic_stage == select_1)
|
||||
{
|
||||
# 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);
|
||||
|
||||
--error 128
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
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 non-word delimiter combined with negate "-" operator
|
||||
# This should return the same result as 'mysql - (Security DBMS)'
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
|
||||
# Again, the operator sequence should not matter
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
|
||||
# Test query expansion
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
}
|
||||
|
||||
if ($basic_stage == insert_2)
|
||||
{
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test query expansion','for database ...');
|
||||
}
|
||||
|
||||
if ($basic_stage == select_2)
|
||||
{
|
||||
# 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);
|
||||
}
|
||||
|
||||
if ($basic_stage == insert_3)
|
||||
{
|
||||
# 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');
|
||||
}
|
||||
|
||||
if ($basic_stage == select_3)
|
||||
{
|
||||
# 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);
|
||||
}
|
@@ -1,252 +1,33 @@
|
||||
# This is the basic function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
--let $modify_create_table= 1
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
# Create FTS table
|
||||
--error ER_INNODB_NO_FT_TEMP_TABLE
|
||||
CREATE TEMPORARY TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
let $basic_stage= create_table;
|
||||
--source basic.inc
|
||||
|
||||
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 ...');
|
||||
let $basic_stage= insert_1;
|
||||
--source basic.inc
|
||||
|
||||
-- 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);
|
||||
let $basic_stage= select_1;
|
||||
--source basic.inc
|
||||
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
let $basic_stage= insert_2;
|
||||
--source basic.inc
|
||||
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
let $basic_stage= select_2;
|
||||
--source basic.inc
|
||||
|
||||
let $basic_stage= insert_3;
|
||||
--source basic.inc
|
||||
|
||||
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);
|
||||
|
||||
--error 128
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
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 non-word delimiter combined with negate "-" operator
|
||||
# This should return the same result as 'mysql - (Security DBMS)'
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
|
||||
# Again, the operator sequence should not matter
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' 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);
|
||||
let $basic_stage= select_3;
|
||||
--source basic.inc
|
||||
|
||||
drop table articles;
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/maybe_debug.inc
|
||||
if ($have_debug) { source include/have_debug_sync.inc; }
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
FLUSH TABLES;
|
||||
# Following are test for crash recovery on FTS index, the first scenario
|
||||
@@ -23,6 +24,16 @@ CREATE TABLE articles (
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
let $vers= $MTR_COMBINATION_VERS + $MTR_COMBINATION_VERS_TRX;
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('history','Deleted row ...');
|
||||
DELETE FROM articles;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Drop the FTS index before more insertion. The FTS_DOC_ID should
|
||||
# be kept
|
||||
DROP INDEX title ON articles;
|
||||
@@ -118,6 +129,13 @@ INSERT INTO articles (title,body) VALUES
|
||||
# Recreate fulltext index to see if everything is OK
|
||||
CREATE FULLTEXT INDEX idx ON articles (title,body);
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
UPDATE articles SET id= id - 1;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Should return 3 rows
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
@@ -159,6 +177,13 @@ disconnect dml;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
UPDATE articles SET id= id - 1 WHERE id > 8;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Should return 6 rows
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
@@ -195,6 +220,15 @@ BEGIN;
|
||||
INSERT INTO articles VALUES
|
||||
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
DELETE FROM articles WHERE id = 100;
|
||||
INSERT INTO articles VALUES
|
||||
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
connect(dml2, localhost, root,,);
|
||||
|
||||
--echo #
|
||||
|
@@ -1,4 +1,5 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
--echo #
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
CREATE TABLE t1 (
|
||||
i int(10) unsigned not null auto_increment primary key,
|
||||
@@ -212,7 +213,17 @@ delete from t1 limit 1;
|
||||
#
|
||||
# BUG#16489: utf8 + fulltext leads to corrupt index file.
|
||||
#
|
||||
if ($MTR_COMBINATION_ORIG)
|
||||
{
|
||||
truncate table t1;
|
||||
}
|
||||
if (!$MTR_COMBINATION_ORIG)
|
||||
{
|
||||
--disable_query_log
|
||||
delete from t1;
|
||||
--enable_query_log
|
||||
--echo 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);
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# test of new fulltext search features
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# Bugreport due to Roy Nasser <roy@vem.ca>
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# bug reported by Tibor Simko <tibor.simko@cern.ch>
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# Test for bug from Jean-C<>dric COSTA <jean-cedric.costa@ensmp.fr>
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# several FULLTEXT indexes in one table test
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# Test for bug by voi@ims.at
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# Fulltext configurable parameters
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
# Save ft_boolean_syntax variable
|
||||
let $saved_ft_boolean_syntax=`select @@global.ft_boolean_syntax`;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
# This is the DDL function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE fts_test (
|
||||
@@ -54,7 +55,21 @@ SELECT * FROM fts_test WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Truncate table
|
||||
let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX;
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
CREATE TABLE fts_test2 LIKE fts_test;
|
||||
DROP TABLE fts_test;
|
||||
RENAME TABLE fts_test2 TO fts_test;
|
||||
--enable_query_log
|
||||
--echo TRUNCATE TABLE fts_test;
|
||||
}
|
||||
if (!$vers)
|
||||
{
|
||||
TRUNCATE TABLE fts_test;
|
||||
}
|
||||
|
||||
DROP INDEX idx ON fts_test;
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
# This is the basic function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
|
||||
|
@@ -1 +0,0 @@
|
||||
--loose-innodb-ft-default-stopword
|
@@ -1,664 +0,0 @@
|
||||
# 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);
|
||||
|
||||
|
||||
--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);
|
||||
|
||||
|
||||
--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);
|
||||
|
||||
|
||||
--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');
|
||||
|
||||
|
||||
--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');
|
||||
|
||||
--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
|
||||
|
||||
--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;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB;
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# b) more words across records
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# Test With two FTS index on same table + alter/create/drop index + tnx
|
||||
#------------------------------------------------------------------------------
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
# This is the DDL function tests for innodb FTS
|
||||
# Functional testing with FTS proximity search using '@'
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
# Must have debug code to use SET SESSION debug
|
||||
--source include/have_debug.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE t1 (
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
# Embedded server tests do not support restarting
|
||||
--source include/not_embedded.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
SELECT @@innodb_ft_server_stopword_table;
|
||||
SELECT @@innodb_ft_enable_stopword;
|
||||
|
@@ -5,6 +5,7 @@
|
||||
# 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.
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
|
||||
--disable_warnings
|
||||
|
@@ -7,6 +7,7 @@
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
# Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE(
|
||||
# TABLE->FTS->INDEXES, ALTER TABLE
|
||||
@@ -91,7 +92,14 @@ SET @saved_debug_dbug= @@debug_dbug;
|
||||
|
||||
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
|
||||
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
|
||||
if ($MTR_COMBINATION_ORIG)
|
||||
{
|
||||
TRUNCATE t1;
|
||||
}
|
||||
if (!$MTR_COMBINATION_ORIG)
|
||||
{
|
||||
--echo TRUNCATE t1;
|
||||
}
|
||||
SET debug_dbug=@saved_debug_dbug;
|
||||
DROP TABLE t1;
|
||||
--echo # End of 10.3 tests
|
||||
|
55
mysql-test/suite/innodb_fts/t/stopword.inc
Normal file
55
mysql-test/suite/innodb_fts/t/stopword.inc
Normal file
@@ -0,0 +1,55 @@
|
||||
if ($stopword_stage == create_table)
|
||||
{
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
|
||||
|
||||
select * from information_schema.innodb_ft_default_stopword;
|
||||
|
||||
# Create FTS table
|
||||
eval CREATE TABLE $stopword_table (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
# Insert six rows
|
||||
eval INSERT INTO $stopword_table (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
|
||||
eval SELECT * FROM $stopword_table WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# Provide user defined stopword table, if not (correctly) defined,
|
||||
# it will be rejected
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
|
||||
# Define a correct formatted user stopword table
|
||||
eval create table user_stopword(value varchar(30))$create_options engine = innodb;
|
||||
|
||||
# The set operation should be successful
|
||||
set global innodb_ft_server_stopword_table = "test/user_stopword";
|
||||
|
||||
eval drop index title on $stopword_table;
|
||||
|
||||
eval create fulltext index idx on $stopword_table(title, body);
|
||||
}
|
||||
|
||||
if ($stopword_stage == select_1)
|
||||
{
|
||||
--error 0, ER_INDEX_CORRUPT
|
||||
eval SELECT * FROM $stopword_table WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
--error 0, ER_INDEX_CORRUPT
|
||||
eval SELECT * FROM $stopword_table WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
}
|
@@ -1,52 +1,16 @@
|
||||
# This is the basic function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
|
||||
|
||||
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 $modify_create_table= 1
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
|
||||
SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
|
||||
SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
|
||||
|
||||
# Provide user defined stopword table, if not (correctly) defined,
|
||||
# it will be rejected
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
|
||||
# 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);
|
||||
let $stopword_table= articles;
|
||||
let $stopword_stage= create_table;
|
||||
--source stopword.inc
|
||||
|
||||
# Now we should be able to find "the"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
@@ -55,12 +19,12 @@ SELECT * FROM articles WHERE MATCH (title,body)
|
||||
# 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 (
|
||||
eval CREATE TABLE articles_2 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_2 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
@@ -71,15 +35,17 @@ SELECT * FROM articles_2 WHERE MATCH (title,body)
|
||||
|
||||
# Ok, let's instantiate some value into user supplied stop word
|
||||
# table
|
||||
insert into user_stopword values("the");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this");
|
||||
|
||||
# Ok, let's repeat with the new table again.
|
||||
CREATE TABLE articles_3 (
|
||||
eval CREATE TABLE articles_3 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_3 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
@@ -89,18 +55,20 @@ 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;
|
||||
eval create table user_stopword_session(value varchar(30))$create_options engine = innodb;
|
||||
|
||||
insert into user_stopword values("this");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword_session values("session");
|
||||
|
||||
set session innodb_ft_user_stopword_table="test/user_stopword_session";
|
||||
|
||||
CREATE TABLE articles_4 (
|
||||
eval CREATE TABLE articles_4 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_4 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
@@ -114,12 +82,12 @@ SELECT * FROM articles_4 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
--connect (con1,localhost,root,,)
|
||||
CREATE TABLE articles_5 (
|
||||
eval CREATE TABLE articles_5 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_5 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
@@ -153,12 +121,12 @@ SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
# the settings.
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
eval CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
@@ -292,12 +260,12 @@ SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
eval CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
@@ -311,15 +279,17 @@ INSERT INTO articles (title,body) VALUES
|
||||
# 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;
|
||||
# Define a correct formatted user stopword table
|
||||
eval create table user_stopword(value varchar(30))$create_options 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;
|
||||
# Define a correct formatted server stopword table
|
||||
eval create table server_stopword(value varchar(30))$create_options 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("when"),("where");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
@@ -390,12 +360,12 @@ SET SESSION innodb_ft_user_stopword_table=default;
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
eval CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
@@ -411,8 +381,8 @@ INSERT INTO articles (title,body) VALUES
|
||||
# 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;
|
||||
# Define a correct formatted user stopword table
|
||||
eval create table user_stopword(value varchar(30))$create_options 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");
|
||||
@@ -433,8 +403,8 @@ 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;
|
||||
# Define a correct formatted user stopword table
|
||||
eval create table server_stopword(value varchar(30))$create_options 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");
|
||||
@@ -487,12 +457,12 @@ SET SESSION innodb_ft_user_stopword_table=default;
|
||||
# FTS stopword list test - check varaibles across sessions
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
eval CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
)$create_options ENGINE=InnoDB;
|
||||
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
@@ -572,8 +542,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOL
|
||||
--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;
|
||||
# Define a correct formatted user stopword table
|
||||
eval create table user_stopword(value varchar(30))$create_options 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
|
||||
@@ -592,8 +562,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
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;
|
||||
# Define a correct formatted user stopword table
|
||||
eval create table user_stopword_1(value varchar(30))$create_options 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");
|
||||
@@ -614,8 +584,8 @@ 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;
|
||||
# Define a correct formatted server stopword table
|
||||
eval create table server_stopword(value varchar(30))$create_options engine = innodb;
|
||||
# The set operation should be successful
|
||||
SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
|
@@ -7,6 +7,7 @@
|
||||
--source include/not_valgrind.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/not_crashrep.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connection default;
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
#--------------------------------------
|
||||
# Check FTS_sync vs TRUNCATE (1)
|
||||
@@ -23,7 +24,16 @@ INSERT INTO t1 (value) VALUES
|
||||
('By default or with the IN NATURAL LANGUAGE MODE modifier')
|
||||
;
|
||||
|
||||
let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX;
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--echo TRUNCATE TABLE t1;
|
||||
}
|
||||
if (!$vers)
|
||||
{
|
||||
TRUNCATE TABLE t1;
|
||||
}
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -54,7 +64,14 @@ INSERT INTO t1 (value) VALUES
|
||||
('collation of latin1_bin to make it case sensitive')
|
||||
;
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--echo TRUNCATE TABLE t1;
|
||||
}
|
||||
if (!$vers)
|
||||
{
|
||||
TRUNCATE TABLE t1;
|
||||
}
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
2
mysql-test/suite/innodb_fts/t/versioning.combinations
Normal file
2
mysql-test/suite/innodb_fts/t/versioning.combinations
Normal file
@@ -0,0 +1,2 @@
|
||||
[prepare]
|
||||
[upgrade]
|
2
mysql-test/suite/innodb_fts/t/versioning.opt
Normal file
2
mysql-test/suite/innodb_fts/t/versioning.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--innodb-file-per-table=0
|
||||
--innodb-doublewrite=0
|
143
mysql-test/suite/innodb_fts/t/versioning.test
Normal file
143
mysql-test/suite/innodb_fts/t/versioning.test
Normal file
@@ -0,0 +1,143 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_gzip.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# Combinations
|
||||
#
|
||||
# upgrade: test upgrade on prepared databases from std_data.
|
||||
# prepare: requires $OLD_BINDIR, test upgrade and downgrade with old-version
|
||||
# server. Also prepare std_data files during the run in the source
|
||||
# directory (you just have to commit or reject them).
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# export OLD_BINDIR="/home/midenok/src/mariadb/10.3b/build"
|
||||
# ./mtr innodb_fts.versioning,prepare
|
||||
#
|
||||
|
||||
if ($MTR_COMBINATION_PREPARE)
|
||||
{
|
||||
if (!$OLD_BINDIR)
|
||||
{
|
||||
--skip Requires OLD_BINDIR parameter (see test comment)
|
||||
}
|
||||
}
|
||||
|
||||
--let $server_id= `select @@server_id`
|
||||
--let $datadir= `select @@datadir`
|
||||
--let $std_dir= $MYSQL_TEST_DIR/std_data/versioning
|
||||
--let $restart_noprint= 3
|
||||
|
||||
--echo # Upgrade test
|
||||
let $stopword_table= articles2;
|
||||
|
||||
if ($MTR_COMBINATION_PREPARE)
|
||||
{
|
||||
let $restart_bindir= $OLD_BINDIR;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
let $create_options= with system versioning;
|
||||
let $basic_stage= create_table;
|
||||
--source basic.inc
|
||||
let $basic_stage= insert_1;
|
||||
--source basic.inc
|
||||
let $basic_stage= insert_2;
|
||||
--source basic.inc
|
||||
let $basic_stage= insert_3;
|
||||
--source basic.inc
|
||||
let $stopword_stage= create_table;
|
||||
--source stopword.inc
|
||||
eval insert into $stopword_table (title, body)
|
||||
values ('test for stopwords','this is it...');
|
||||
insert into user_stopword values("the");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this");
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
--exec mkdir -p $std_dir
|
||||
--exec cp -af $datadir/ibdata1 $datadir/test/*.frm $std_dir
|
||||
# zero out the doublewrite buffer
|
||||
--exec dd if=/dev/zero of=$std_dir/ibdata1 bs=16k seek=64 count=128 conv=notrunc
|
||||
--exec gzip -9f $std_dir/ibdata1 $std_dir/*.frm
|
||||
}
|
||||
|
||||
if ($MTR_COMBINATION_UPGRADE)
|
||||
{
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("InnoDB: Table `mysql`.\`innodb_(table|index)_stats`");
|
||||
--enable_query_log
|
||||
--source include/shutdown_mysqld.inc
|
||||
--exec rm -f $datadir/test/*.ibd $datadir/ib*
|
||||
--exec cp -af $std_dir/ibdata1.gz $datadir
|
||||
--exec cp -af $std_dir/*.frm.gz $datadir/test
|
||||
--exec gzip -df $datadir/ibdata1.gz $datadir/test/*.frm.gz
|
||||
}
|
||||
let $restart_bindir=;
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
if ($MTR_COMBINATION_UPGRADE)
|
||||
{
|
||||
# The system tablespace was replaced with a 10.3 one that contains
|
||||
# the InnoDB statistics tables. These tables are corrupted from our
|
||||
# point of view. Drop the tables, but retain the .frm files to keep
|
||||
# mtr.check_testcase() happy.
|
||||
--move_file $datadir/mysql/innodb_index_stats.frm $datadir/iis.frm
|
||||
--move_file $datadir/mysql/innodb_table_stats.frm $datadir/its.frm
|
||||
DROP TABLE mysql.innodb_table_stats, mysql.innodb_index_stats;
|
||||
--move_file $datadir/its.frm $datadir/mysql/innodb_table_stats.frm
|
||||
--move_file $datadir/iis.frm $datadir/mysql/innodb_index_stats.frm
|
||||
}
|
||||
--error ER_INDEX_CORRUPT
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
|
||||
alter table articles force;
|
||||
flush tables;
|
||||
show create table articles;
|
||||
|
||||
let $basic_stage= select_1;
|
||||
source basic.inc;
|
||||
let $basic_stage= select_2;
|
||||
source basic.inc;
|
||||
let $basic_stage= select_3;
|
||||
source basic.inc;
|
||||
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
let $stopword_stage= select_1;
|
||||
--source stopword.inc
|
||||
eval drop index idx on $stopword_table;
|
||||
eval create fulltext index idx on $stopword_table(title, body);
|
||||
--source stopword.inc
|
||||
|
||||
if ($MTR_COMBINATION_PREPARE)
|
||||
{
|
||||
--echo # Downgrade test
|
||||
let $restart_bindir= $OLD_BINDIR;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
alter table articles force;
|
||||
flush tables;
|
||||
show create table articles;
|
||||
let $basic_stage= select_1;
|
||||
source basic.inc;
|
||||
let $basic_stage= select_2;
|
||||
source basic.inc;
|
||||
let $basic_stage= select_3;
|
||||
source basic.inc;
|
||||
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
let $stopword_stage= select_1;
|
||||
# Downgrade faults with assertion "dict_index_get_n_unique(index) == 1"
|
||||
# until we rebuilt the index:
|
||||
eval drop index idx on $stopword_table;
|
||||
eval create fulltext index idx on $stopword_table(title, body);
|
||||
source stopword.inc;
|
||||
|
||||
let $restart_bindir=;
|
||||
--source include/restart_mysqld.inc
|
||||
}
|
||||
|
||||
--echo # Cleanup
|
||||
eval drop tables articles, $stopword_table, user_stopword;
|
||||
set global innodb_ft_server_stopword_table= default;
|
Reference in New Issue
Block a user