Commit ea3262dc authored by Sergei Golubchik's avatar Sergei Golubchik

Fix innodb_fts suite

* update (some) tests from 5.7
* update results (e.g. cardinality is no longer reported)
* uncomment MYSQL_PLUGIN_FULLTEXT_PARSER/MYSQL_FTS_PARSER code
* initialize m_prebuilt->m_fts_limit manually,
   as we do not use ft_init_ext_with_hints()
parent 4133d294
...@@ -8,8 +8,8 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), ...@@ -8,8 +8,8 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
ANALYZE TABLE t1; ANALYZE TABLE t1;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL 5 NULL NULL YES FULLTEXT t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL 5 NULL NULL YES FULLTEXT t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections"); select * from t1 where MATCH(a,b) AGAINST ("collections");
a b a b
Full-text indexes are called collections Full-text indexes are called collections
...@@ -235,7 +235,7 @@ id ...@@ -235,7 +235,7 @@ id
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 1 tig 1 ticket A 3 NULL NULL YES BTREE t2 1 tig 1 ticket A 3 NULL NULL YES BTREE
t2 1 tix 1 inhalt NULL 3 NULL NULL YES FULLTEXT t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
......
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`");
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
......
INSTALL PLUGIN simple_parser SONAME 'mypluglib'; INSTALL PLUGIN simple_parser SONAME 'mypluglib';
# Test Part 1: Grammar Test
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM; ) ENGINE=MyISAM;
ALTER TABLE articles ENGINE=InnoDB; ALTER TABLE articles ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
DROP TABLE articles; DROP TABLE articles;
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
body TEXT, body TEXT,
comment TEXT,
FULLTEXT (title) WITH PARSER simple_parser FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB; ) ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser;
DROP TABLE articles;
# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX)
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
body TEXT, body TEXT,
FULLTEXT (title) FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB; ) ENGINE=InnoDB;
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser; INSERT INTO articles (title, body) VALUES
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser; ('How To Use MySQL Well','After you went through a ...'),
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table ('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL 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 How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
DROP TABLE articles;
# Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT
) ENGINE=InnoDB;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL 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 How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
id title body
5 Go MySQL Tricks How to use full text search engine
4 1001 MySQL Tricks How to use full-text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
DROP TABLE articles;
# Test Part 3 END
# Test Part 4:crash on commit(before/after)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
BEGIN;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT COUNT(*) FROM articles;
COUNT(*)
0
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT COUNT(*) FROM articles;
COUNT(*)
5
DROP TABLE articles;
# Test Part 5: Test Uninstall Plugin After Index is Built
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
UNINSTALL PLUGIN simple_parser;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...');
ERROR HY000: Plugin 'simple_parser' is not loaded
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
UNINSTALL PLUGIN simple_parser;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL 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 How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
CREATE TABLE articles2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
ERROR HY000: Function 'simple_parser' is not defined
DROP TABLE articles; DROP TABLE articles;
UNINSTALL PLUGIN simple_parser; UNINSTALL PLUGIN simple_parser;
ERROR 42000: PLUGIN simple_parser does not exist
...@@ -128,7 +128,7 @@ WHERE MATCH (a,b) ...@@ -128,7 +128,7 @@ WHERE MATCH (a,b)
AGAINST ('"mysql use"@1' IN BOOLEAN MODE); AGAINST ('"mysql use"@1' IN BOOLEAN MODE);
id a b id a b
INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000)); INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000));
INSERT INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob'); INSERT IGNORE INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1
SELECT count(*) FROM t1 SELECT count(*) FROM t1
...@@ -137,7 +137,6 @@ AGAINST ('"xyz blob"@3' IN BOOLEAN MODE); ...@@ -137,7 +137,6 @@ AGAINST ('"xyz blob"@3' IN BOOLEAN MODE);
count(*) count(*)
2 2
DROP TABLE t1; DROP TABLE t1;
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1; set global innodb_file_per_table=1;
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
...@@ -225,5 +224,4 @@ AGAINST ('"very blob"@3' IN BOOLEAN MODE); ...@@ -225,5 +224,4 @@ AGAINST ('"very blob"@3' IN BOOLEAN MODE);
count(*) count(*)
1 1
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_per_table=1; SET GLOBAL innodb_file_per_table=1;
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
-- source include/have_innodb.inc -- source include/have_innodb.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`");
# Create FTS table # Create FTS table
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
......
--source include/have_simple_parser.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_simple_parser.inc
# Restart is not supported in embedded
--source include/not_embedded.inc
# Install fts parser plugin # Install fts parser plugin
INSTALL PLUGIN simple_parser SONAME 'mypluglib'; INSTALL PLUGIN simple_parser SONAME 'mypluglib';
-- echo # Test Part 1: Grammar Test
# Create a myisam table and alter it to innodb table # Create a myisam table and alter it to innodb table
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM; ) ENGINE=MyISAM;
--error ER_INNODB_NO_FT_USES_PARSER
ALTER TABLE articles ENGINE=InnoDB; ALTER TABLE articles ENGINE=InnoDB;
DROP TABLE articles; DROP TABLE articles;
# Create a table having a full text index with parser # Create a table having a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
body TEXT, body TEXT,
comment TEXT,
FULLTEXT (title) WITH PARSER simple_parser FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB; ) ENGINE=InnoDB;
# Alter table to add a full text index with parser
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
# Create a full text index with parser
CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser;
DROP TABLE articles;
-- echo # Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX)
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
body TEXT, body TEXT,
FULLTEXT (title) FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB; ) ENGINE=InnoDB;
# Alter table to add a full text index with parser INSERT INTO articles (title, body) VALUES
--error ER_INNODB_NO_FT_USES_PARSER ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser; ('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
# Create a full text index with parser # Simple term search
--error ER_INNODB_NO_FT_USES_PARSER SELECT * FROM articles WHERE
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser; MATCH(title, body) AGAINST('mysql');
# Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
-- echo # Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
# No result here, we get '"mysql' 'database"' by simple parser
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
DROP TABLE articles;
-- echo # Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT
) ENGINE=InnoDB;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
# Create fulltext index
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
# Simple term search
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
# Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
-- echo # Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
# Test query expansion
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
# No result here, we get '"mysql' 'database"' by simple parser
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
DROP TABLE articles;
-- echo # Test Part 3 END
-- echo # Test Part 4:crash on commit(before/after)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
BEGIN;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
--source include/restart_mysqld.inc
SELECT COUNT(*) FROM articles;
# Simple term search - no records expected
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
--source include/restart_mysqld.inc
# Simple term search - 4 records expected
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
SELECT COUNT(*) FROM articles;
DROP TABLE articles;
-- echo # Test Part 5: Test Uninstall Plugin After Index is Built
# Note: this test should be the last one because we uninstall plugin
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
# Uninstall plugin
UNINSTALL PLUGIN simple_parser;
-- error ER_PLUGIN_IS_NOT_LOADED
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...');
# Reinstall plugin
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
# Get warning here
UNINSTALL PLUGIN simple_parser;
# Simple term search
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
# Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
-- echo # Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
-- error ER_FUNCTION_NOT_DEFINED
CREATE TABLE articles2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
DROP TABLE articles; DROP TABLE articles;
# Uninstall plugin # Uninstall plugin
-- error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN simple_parser; UNINSTALL PLUGIN simple_parser;
--source include/have_innodb.inc
# This is the DDL function tests for innodb FTS # This is the DDL function tests for innodb FTS
# Functional testing with FTS proximity search using '@' # Functional testing with FTS proximity search using '@'
# and try search default words # and try search default words
--source include/have_innodb.inc
if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in InnoDB 5.6.10 or earlier
}
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
--disable_query_log --disable_query_log
let $innodb_file_format_orig = `select @@innodb_file_format`;
let $innodb_file_per_table_orig = `select @@innodb_file_per_table`; let $innodb_file_per_table_orig = `select @@innodb_file_per_table`;
--enable_query_log --enable_query_log
...@@ -156,7 +151,7 @@ SELECT * FROM t1 ...@@ -156,7 +151,7 @@ SELECT * FROM t1
INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000)); INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000));
INSERT INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob'); INSERT IGNORE INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
# 2 rows match # 2 rows match
SELECT count(*) FROM t1 SELECT count(*) FROM t1
...@@ -165,7 +160,6 @@ SELECT count(*) FROM t1 ...@@ -165,7 +160,6 @@ SELECT count(*) FROM t1
DROP TABLE t1; DROP TABLE t1;
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1; set global innodb_file_per_table=1;
# Test fts with externally stored long column # Test fts with externally stored long column
...@@ -263,5 +257,4 @@ SELECT count(*) FROM t1 ...@@ -263,5 +257,4 @@ SELECT count(*) FROM t1
DROP TABLE t1; DROP TABLE t1;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
...@@ -7215,7 +7215,6 @@ ha_innobase::open( ...@@ -7215,7 +7215,6 @@ ha_innobase::open(
dict_table_autoinc_unlock(m_prebuilt->table); dict_table_autoinc_unlock(m_prebuilt->table);
} }
#if MYSQL_PLUGIN_FULLTEXT_PARSER
/* Set plugin parser for fulltext index */ /* Set plugin parser for fulltext index */
for (uint i = 0; i < table->s->keys; i++) { for (uint i = 0; i < table->s->keys; i++) {
if (table->key_info[i].flags & HA_USES_PARSER) { if (table->key_info[i].flags & HA_USES_PARSER) {
...@@ -7236,7 +7235,6 @@ ha_innobase::open( ...@@ -7236,7 +7235,6 @@ ha_innobase::open(
index->parser = &fts_default_parser;); index->parser = &fts_default_parser;);
} }
} }
#endif
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
...@@ -11148,6 +11146,8 @@ ha_innobase::ft_init_ext( ...@@ -11148,6 +11146,8 @@ ha_innobase::ft_init_ext(
const byte* q = reinterpret_cast<const byte*>( const byte* q = reinterpret_cast<const byte*>(
const_cast<char*>(query)); const_cast<char*>(query));
// JAN: TODO: support for ft_init_ext_with_hints(), remove the line below
m_prebuilt->m_fts_limit= ULONG_UNDEFINED;
dberr_t error = fts_query(trx, index, flags, q, query_len, &result, dberr_t error = fts_query(trx, index, flags, q, query_len, &result,
m_prebuilt->m_fts_limit); m_prebuilt->m_fts_limit);
......
...@@ -632,6 +632,8 @@ extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id); ...@@ -632,6 +632,8 @@ extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id);
extern const struct _ft_vft ft_vft_result; extern const struct _ft_vft ft_vft_result;
#define FTS_NGRAM_PARSER_NAME "ngram"
/** Structure Returned by ha_innobase::ft_init_ext() */ /** Structure Returned by ha_innobase::ft_init_ext() */
typedef struct new_ft_info typedef struct new_ft_info
{ {
......
...@@ -2248,7 +2248,6 @@ innobase_create_index_def( ...@@ -2248,7 +2248,6 @@ innobase_create_index_def(
| HA_BINARY_PACK_KEY))); | HA_BINARY_PACK_KEY)));
index->ind_type = DICT_FTS; index->ind_type = DICT_FTS;
#ifdef MYSQL_FTS_PARSER
/* Note: key->parser is only parser name, /* Note: key->parser is only parser name,
we need to get parser from altered_table instead */ we need to get parser from altered_table instead */
...@@ -2279,7 +2278,6 @@ innobase_create_index_def( ...@@ -2279,7 +2278,6 @@ innobase_create_index_def(
index->parser = &fts_default_parser;); index->parser = &fts_default_parser;);
ut_ad(index->parser); ut_ad(index->parser);
} }
#endif /* MYSQL_FTS_PARSER */
} else if (key->flags & HA_SPATIAL) { } else if (key->flags & HA_SPATIAL) {
DBUG_ASSERT(!(key->flags & HA_NOSAME)); DBUG_ASSERT(!(key->flags & HA_NOSAME));
index->ind_type = DICT_SPATIAL; index->ind_type = DICT_SPATIAL;
......
...@@ -43,7 +43,6 @@ struct fts_string_t; ...@@ -43,7 +43,6 @@ struct fts_string_t;
#undef MYSQL_57_SELECT_COUNT_OPTIMIZATION #undef MYSQL_57_SELECT_COUNT_OPTIMIZATION
#undef MYSQL_COMPRESSION #undef MYSQL_COMPRESSION
#undef MYSQL_ENCRYPTION #undef MYSQL_ENCRYPTION
#undef MYSQL_FTS_PARSER
#undef MYSQL_FT_INIT_EXT #undef MYSQL_FT_INIT_EXT
#undef MYSQL_INNODB_API_CB #undef MYSQL_INNODB_API_CB
#undef MYSQL_INNODB_PARTITIONING #undef MYSQL_INNODB_PARTITIONING
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment