summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb_fts/t/stopword.inc
blob: 774501ade85a38234bed7ca31f0adf039f4e2689 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);

}