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

145 lines
5.2 KiB
Plaintext

SET NAMES utf8mb4;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
content TEXT,
FULLTEXT INDEX ft_content (content)
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
INSERT INTO t1 (title, content) VALUES ('中国', '中国'), ('中国上海', '中国上海');
ALTER TABLE t1 ADD FULLTEXT INDEX ft_title (title);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(200) DEFAULT NULL,
`content` text,
PRIMARY KEY (`id`),
FULLTEXT KEY `ft_content` (`content`),
FULLTEXT KEY `ft_title` (`title`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=gb2312
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
id title content
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
id title content
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国') ORDER BY id;
id title content
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海') ORDER BY id;
id title content
2 中国上海 中国上海
DROP TABLE t1;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
content TEXT,
FULLTEXT INDEX ft_content (content) WITH PARSER ngram
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
INSERT INTO t1 (title, content) VALUES ('中国', '中国'), ('中国上海', '中国上海');
ALTER TABLE t1 ADD FULLTEXT INDEX ft_title (title) WITH PARSER ngram;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(200) DEFAULT NULL,
`content` text,
PRIMARY KEY (`id`),
FULLTEXT KEY `ft_content` (`content`) /*!50100 WITH PARSER `ngram` */ ,
FULLTEXT KEY `ft_title` (`title`) /*!50100 WITH PARSER `ngram` */
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=gb2312
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
CREATE TABLE t2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
content TEXT,
FULLTEXT INDEX ft_content (content) WITH PARSER ngram
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
ALTER TABLE t2 ADD FULLTEXT INDEX ft_title (title) WITH PARSER ngram;
# restart: --ngram=OFF
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Plugin 'ngram' is not loaded
test.t1 check error Corrupt
SELECT * FROM t1;
ERROR HY000: Plugin 'ngram' is not loaded
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国');
ERROR HY000: Plugin 'ngram' is not loaded
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海');
ERROR HY000: Plugin 'ngram' is not loaded
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国');
ERROR HY000: Plugin 'ngram' is not loaded
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海');
ERROR HY000: Plugin 'ngram' is not loaded
INSERT INTO t1 (title, content) VALUES ('中国', '中国');
ERROR HY000: Plugin 'ngram' is not loaded
DROP INDEX ft_title ON t1;
ERROR HY000: Plugin 'ngram' is not loaded
DROP INDEX ft_content ON t1;
ERROR HY000: Plugin 'ngram' is not loaded
TRUNCATE TABLE t1;
ERROR HY000: Plugin 'ngram' is not loaded
ALTER TABLE t1 RENAME TO t3;
ERROR HY000: Plugin 'ngram' is not loaded
RENAME TABLE t2 to t3;
DROP TABLE t3;
CREATE TABLE t2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT INDEX ft_title (title) WITH PARSER ngram
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
ERROR HY000: Function 'ngram' is not defined
CREATE TABLE t2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200)
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
ALTER TABLE t2 ADD FULLTEXT INDEX ft_title (title) WITH PARSER ngram;
ERROR HY000: Function 'ngram' is not defined
ALTER TABLE t2 ADD FULLTEXT INDEX ft_title (title);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
INSERT INTO t2 (title) VALUES ('中国');
SELECT * FROM t2 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
id title
SELECT * FROM t2 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
id title
DROP TABLE t2;
# restart
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT * FROM t1;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(title) AGAINST('中国上海') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
SELECT * FROM t1 WHERE MATCH(content) AGAINST('中国上海') ORDER BY id;
id title content
1 中国 中国
2 中国上海 中国上海
DROP TABLE t1;