Debian Codegraph @

mysql-test/suite/innodb_fts/r/ngram_2.result

raw
1 SET NAMES utf8mb4;
2 CREATE TABLE t1 (
3 id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
4 title VARCHAR(200),
5 content TEXT,
6 FULLTEXT INDEX ft_content (content)
7 ) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
8 INSERT INTO t1 (title, content) VALUES ('中国', '中国'), ('中国上海', '中国上海');
9 ALTER TABLE t1 ADD FULLTEXT INDEX ft_title (title);
10 SHOW CREATE TABLE t1;
11 Table Create Table
12 t1 CREATE TABLE `t1` (
13 `id` int unsigned NOT NULL AUTO_INCREMENT,
14 `title` varchar(200) DEFAULT NULL,
15 `content` text,
16 PRIMARY KEY (`id`),
17 FULLTEXT KEY `ft_content` (`content`),
18 FULLTEXT KEY `ft_title` (`title`)
19 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=gb2312
20 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
21 id title content
22 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
23 id title content
24 2 中国上海 中国上海
25 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国') ORDER BY id;
26 id title content
27 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海') ORDER BY id;
28 id title content
29 2 中国上海 中国上海
30 DROP TABLE t1;
31 CREATE TABLE t1 (
32 id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
33 title VARCHAR(200),
34 content TEXT,
35 FULLTEXT INDEX ft_content (content) WITH PARSER ngram
36 ) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
37 INSERT INTO t1 (title, content) VALUES ('中国', '中国'), ('中国上海', '中国上海');
38 ALTER TABLE t1 ADD FULLTEXT INDEX ft_title (title) WITH PARSER ngram;
39 SHOW CREATE TABLE t1;
40 Table Create Table
41 t1 CREATE TABLE `t1` (
42 `id` int unsigned NOT NULL AUTO_INCREMENT,
43 `title` varchar(200) DEFAULT NULL,
44 `content` text,
45 PRIMARY KEY (`id`),
46 FULLTEXT KEY `ft_content` (`content`) /*!50100 WITH PARSER `ngram` */ ,
47 FULLTEXT KEY `ft_title` (`title`) /*!50100 WITH PARSER `ngram` */
48 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=gb2312
49 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
50 id title content
51 1 中国 中国
52 2 中国上海 中国上海
53 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
54 id title content
55 1 中国 中国
56 2 中国上海 中国上海
57 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国') ORDER BY id;
58 id title content
59 1 中国 中国
60 2 中国上海 中国上海
61 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海') ORDER BY id;
62 id title content
63 1 中国 中国
64 2 中国上海 中国上海
65 CREATE TABLE t2 (
66 id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
67 title VARCHAR(200),
68 content TEXT,
69 FULLTEXT INDEX ft_content (content) WITH PARSER ngram
70 ) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
71 ALTER TABLE t2 ADD FULLTEXT INDEX ft_title (title) WITH PARSER ngram;
72 # restart: --ngram=OFF
73 CHECK TABLE t1;
74 Table Op Msg_type Msg_text
75 test.t1 check Error Plugin 'ngram' is not loaded
76 test.t1 check error Corrupt
77 SELECT * FROM t1;
78 ERROR HY000: Plugin 'ngram' is not loaded
79 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国');
80 ERROR HY000: Plugin 'ngram' is not loaded
81 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海');
82 ERROR HY000: Plugin 'ngram' is not loaded
83 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国');
84 ERROR HY000: Plugin 'ngram' is not loaded
85 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海');
86 ERROR HY000: Plugin 'ngram' is not loaded
87 INSERT INTO t1 (title, content) VALUES ('中国', '中国');
88 ERROR HY000: Plugin 'ngram' is not loaded
89 DROP INDEX ft_title ON t1;
90 ERROR HY000: Plugin 'ngram' is not loaded
91 DROP INDEX ft_content ON t1;
92 ERROR HY000: Plugin 'ngram' is not loaded
93 TRUNCATE TABLE t1;
94 ERROR HY000: Plugin 'ngram' is not loaded
95 ALTER TABLE t1 RENAME TO t3;
96 ERROR HY000: Plugin 'ngram' is not loaded
97 RENAME TABLE t2 to t3;
98 DROP TABLE t3;
99 CREATE TABLE t2 (
100 id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
101 title VARCHAR(200),
102 FULLTEXT INDEX ft_title (title) WITH PARSER ngram
103 ) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
104 ERROR HY000: Function 'ngram' is not defined
105 CREATE TABLE t2 (
106 id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
107 title VARCHAR(200)
108 ) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
109 ALTER TABLE t2 ADD FULLTEXT INDEX ft_title (title) WITH PARSER ngram;
110 ERROR HY000: Function 'ngram' is not defined
111 ALTER TABLE t2 ADD FULLTEXT INDEX ft_title (title);
112 Warnings:
113 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
114 INSERT INTO t2 (title) VALUES ('中国');
115 SELECT * FROM t2 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
116 id title
117 SELECT * FROM t2 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
118 id title
119 DROP TABLE t2;
120 # restart
121 CHECK TABLE t1;
122 Table Op Msg_type Msg_text
123 test.t1 check status OK
124 SELECT * FROM t1;
125 id title content
126 1 中国 中国
127 2 中国上海 中国上海
128 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
129 id title content
130 1 中国 中国
131 2 中国上海 中国上海
132 SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
133 id title content
134 1 中国 中国
135 2 中国上海 中国上海
136 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国') ORDER BY id;
137 id title content
138 1 中国 中国
139 2 中国上海 中国上海
140 SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海') ORDER BY id;
141 id title content
142 1 中国 中国
143 2 中国上海 中国上海
144 DROP TABLE t1;