summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb_fts/t/stopword.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/innodb_fts/t/stopword.test')
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.test114
1 files changed, 42 insertions, 72 deletions
diff --git a/mysql-test/suite/innodb_fts/t/stopword.test b/mysql-test/suite/innodb_fts/t/stopword.test
index 5105a6d2fec..9f8bd89b816 100644
--- a/mysql-test/suite/innodb_fts/t/stopword.test
+++ b/mysql-test/suite/innodb_fts/t/stopword.test
@@ -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;