Commit 9e8a3d16 authored by Alice Sherepa's avatar Alice Sherepa

innodb_fts.prase, subexpr

parent 0da50a3f
# Bug #18285007 COPY OF TABLES WITH INNODB FTS
# FROM WINDOWS TO LINUX CAUSES CRASH
# Simulating old non-windows(< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
DROP TABLE t1;
# Simulating old windows (< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
DROP TABLE t1;
# Simulation current non windows data directory
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
DROP TABLE t1;
# Non windows aux table flag failure and rebuild the corrupted index.
call mtr.add_suppression("\\[Warning\\] InnoDB: Parent table of FTS auxiliary table .* not found.");
call mtr.add_suppression("\\[ERROR] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
call mtr.add_suppression("\\[Warning\\] InnoDB: Setting aux table .* to hex format failed.");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB` (a, b), FULLTEXT `C1` (c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
ERROR HY000: The table does not have FULLTEXT index to support this query
ALTER TABLE t1 ADD FULLTEXT(b);
ERROR HY000: Index corrupt: Fulltext index 'AB' is corrupt. you should drop this index first.
# Restart the server
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
ERROR HY000: The table does not have FULLTEXT index to support this query
# Drop the corrupted index.
ALTER TABLE t1 DROP INDEX `AB`;
ALTER TABLE t1 DROP INDEX `C1`;
# Rebuild the index.
ALTER TABLE t1 ADD FULLTEXT(a, b);
ALTER TABLE t1 ADD FULLTEXT(c);
# Read the record using fts index.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
DROP TABLE t1;
# Non windows parent table flag failure.
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT(a, b), FULLTEXT(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
DROP TABLE t1;
# Drop FTS table and rename the common tables.
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT f1(a, b));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
alter table t1 drop index f1;
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1;
a b c
TEST1 TEST2 TEXT3
TEXT1 TEXT2 TEXT5
DROP TABLE t1;
# Rename failure for old windows data directory and rebuild the
# corrupted index
call mtr.add_suppression("\\[Warning\\] InnoDB: Failed to rename one aux table .* will revert all successful rename operations.");
call mtr.add_suppression("\\[Warning\\] InnoDB: Rollback operations on all aux tables of table .* All the fts index associated with the table are marked as corrupted. Please rebuild the index again.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB`(a, b), FULLTEXT `C1`(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
# Restart server.
ALTER TABLE t1 ADD FULLTEXT(b);
ERROR HY000: Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
# Restart server.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
ERROR HY000: The table does not have FULLTEXT index to support this query
# Drop the corrupted index.
ALTER TABLE t1 DROP INDEX `AB`;
ALTER TABLE t1 DROP INDEX `C1`;
# Rebuild the index.
ALTER TABLE t1 ADD FULLTEXT(a, b);
ALTER TABLE t1 ADD FULLTEXT(c);
# Read the record using fts index.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
TRUNCATE TABLE t1;
DROP TABLE t1;
# Bug #18285007 COPY OF TABLES WITH INNODB FTS
# FROM WINDOWS TO LINUX CAUSES CRASH
# Simulating old non-windows(< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
DROP TABLE t1;
# Simulating old windows (< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
DROP TABLE t1;
# Simulation current windows data directory
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b
TEST1 TEST2
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_INDEX_1
FTS_0 test/FTS_AUX_INDEX_2
FTS_0 test/FTS_AUX_INDEX_3
FTS_0 test/FTS_AUX_INDEX_4
FTS_0 test/FTS_AUX_INDEX_5
FTS_0 test/FTS_AUX_INDEX_6
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
DROP TABLE t1;
# Non windows aux table flag failure and rebuild the corrupted index.
call mtr.add_suppression("\\[Warning\\] InnoDB: Parent table of FTS auxiliary table .* not found.");
call mtr.add_suppression("\\[ERROR] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
call mtr.add_suppression("\\[Warning\\] InnoDB: Setting aux table .* to hex format failed.");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB` (a, b), FULLTEXT `C1`(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
ERROR HY000: The table does not have FULLTEXT index to support this query
ALTER TABLE t1 ADD FULLTEXT(b);
ERROR HY000: Index corrupt: Fulltext index 'AB' is corrupt. you should drop this index first.
# Restart the server
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
ERROR HY000: The table does not have FULLTEXT index to support this query
# Drop the corrupted index.
ALTER TABLE t1 DROP INDEX `AB`;
ALTER TABLE t1 DROP INDEX `C1`;
# Rebuild the index.
ALTER TABLE t1 ADD FULLTEXT(a, b);
ALTER TABLE t1 ADD FULLTEXT(c);
# Read the record using fts index.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
DROP TABLE t1;
# Non windows parent table flag failure.
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT(a, b), FULLTEXT(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
DROP TABLE t1;
# Drop FTS table and rename the common tables.
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT f1(a, b));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
alter table t1 drop index f1;
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT * FROM t1;
a b c
TEST1 TEST2 TEXT3
TEXT1 TEXT2 TEXT5
DROP TABLE t1;
# Rename failure for old windows data directory and rebuild the
# corrupted index
call mtr.add_suppression("\\[Warning\\] InnoDB: Failed to rename one aux table .* Will revert all successful rename operations.");
call mtr.add_suppression("\\[Warning\\] InnoDB: Rollback operations on all aux tables of table .* All the fts index associated with the table are marked as corrupted. Please rebuild the index again.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB`(a, b), FULLTEXT `C1`(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
# Restart server.
ALTER TABLE t1 ADD FULLTEXT(b);
ERROR HY000: Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
# Restart server.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
ERROR HY000: The table does not have FULLTEXT index to support this query
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
ERROR HY000: The table does not have FULLTEXT index to support this query
# Drop the corrupted index.
ALTER TABLE t1 DROP INDEX `AB`;
ALTER TABLE t1 DROP INDEX `C1`;
# Rebuild the index.
ALTER TABLE t1 ADD FULLTEXT(a, b);
ALTER TABLE t1 ADD FULLTEXT(c);
# Read the record using fts index.
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
a b c
TEST1 TEST2 TEXT3
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
a b c
TEXT1 TEXT2 TEXT5
TRUNCATE TABLE t1;
DROP TABLE t1;
This diff is collapsed.
CREATE TABLE articles (
id INT UNSIGNED NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT (title)
) ENGINE= InnoDB;
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
4 mysql
5 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
ROLLBACK TO SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
4 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
5 mysql
6 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
ROLLBACK TO SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
3 mysql
4 mysql
5 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
RELEASE SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
3 mysql
4 mysql
5 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
3 mysql
4 mysql
5 mysql
6 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
RELEASE SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
3 mysql
4 mysql
5 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
RELEASE SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
4 mysql
5 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
ROLLBACK TO SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
3 mysql
4 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
RELEASE SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
ROLLBACK TO SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
COMMIT;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
2 mysql
3 mysql
5 mysql
6 mysql
7 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
ROLLBACK;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
3 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
ROLLBACK;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
4 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
ROLLBACK;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
5 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
ROLLBACK;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
5 mysql
TRUNCATE TABLE articles;
INSERT INTO articles(id, title) VALUES(1, 'mysql');
BEGIN;
INSERT INTO articles(id, title) VALUES(2, 'mysql');
SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(3, 'mysql');
SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(4, 'mysql');
ROLLBACK TO SAVEPOINT sp2;
INSERT INTO articles(id, title) VALUES(5, 'mysql');
RELEASE SAVEPOINT sp1;
INSERT INTO articles(id, title) VALUES(6, 'mysql');
ROLLBACK;
INSERT INTO articles(id, title) VALUES(7, 'mysql');
SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
id title
1 mysql
7 mysql
DROP TABLE articles;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
) ENGINE=InnoDB;
INSERT INTO articles (title,body) VALUES
(NULL, 'mysql good database'),
(NULL, ' mysql good database'),
('', 'mysql good database'),
('', ' mysql good database'),
(' ', 'mysql good database'),
('mysql', 'good database'),
('mysql ', 'good database'),
('mysql', ' good database'),
('mysql good database', ''),
('mysql good database', NULL);
SET GLOBAL innodb_ft_aux_table="test/articles";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 1 10 10 1 11
database 1 10 10 2 12
database 1 10 10 3 11
database 1 10 10 4 12
database 1 10 10 5 13
database 1 10 10 6 11
database 1 10 10 7 12
database 1 10 10 8 12
database 1 10 10 9 11
database 1 10 10 10 11
good 1 10 10 1 6
good 1 10 10 2 7
good 1 10 10 3 6
good 1 10 10 4 7
good 1 10 10 5 8
good 1 10 10 6 6
good 1 10 10 7 7
good 1 10 10 8 7
good 1 10 10 9 6
good 1 10 10 10 6
mysql 1 10 10 1 0
mysql 1 10 10 2 1
mysql 1 10 10 3 0
mysql 1 10 10 4 1
mysql 1 10 10 5 2
mysql 1 10 10 6 0
mysql 1 10 10 7 0
mysql 1 10 10 8 0
mysql 1 10 10 9 0
mysql 1 10 10 10 0
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM articles;
id title body
1 NULL mysql good database
2 NULL mysql good database
3 mysql good database
4 mysql good database
5 mysql good database
6 mysql good database
7 mysql good database
8 mysql good database
9 mysql good database
10 mysql good database NULL
SELECT * FROM articles WHERE MATCH(title, body)
AGAINST('"mysql good database"' IN BOOLEAN MODE);
id title body
1 NULL mysql good database
2 NULL mysql good database
3 mysql good database
4 mysql good database
5 mysql good database
9 mysql good database
10 mysql good database NULL
SELECT * FROM articles WHERE MATCH(title, body)
AGAINST('("mysql good database")' IN BOOLEAN MODE);
id title body
1 NULL mysql good database
2 NULL mysql good database
3 mysql good database
4 mysql good database
5 mysql good database
9 mysql good database
10 mysql good database NULL
DROP TABLE articles;
#
# Bug #20028323 INNODB FULLTEXT BOOLEAN SEARCH INCORRECTLY HANDLES
# PARENTHESES
#
CREATE TABLE t1 (
f1 INT NOT NULL AUTO_INCREMENT,
f2 TEXT NOT NULL,
PRIMARY KEY (f1),
FULLTEXT (f2)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 (f2) VALUES
('Pumpkin soup with cheese bread'),
('Yellow chicken curry'),
('Fresh green vegetables with garlic');
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE);
f1 f2
1 Pumpkin soup with cheese bread
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE);
f1 f2
1 Pumpkin soup with cheese bread
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE);
f1 f2
1 Pumpkin soup with cheese bread
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE);
f1 f2
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
f1 f2
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE);
f1 f2
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
f1 f2
INSERT INTO t1 (f2) VALUES
('This row contains only souffle'),
('This row contains only tart'),
('This row contains only pumpkin'),
('This row contains only cheese'),
('This row contains pumpkin and souffle'),
('This row contains pumpkin and tart'),
('This row contains pumpkin and cheese'),
('This row contains both souffle and tart'),
('This row contains both souffle and cheese'),
('This row contains both tart and cheese'),
('This row contains all three souffle, pumpkin and tart'),
('This row contains all four cheese, souffle, pumpkin and tart');
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE);
f1 f2
1 Pumpkin soup with cheese bread
6 This row contains only pumpkin
8 This row contains pumpkin and souffle
9 This row contains pumpkin and tart
10 This row contains pumpkin and cheese
14 This row contains all three souffle, pumpkin and tart
15 This row contains all four cheese, souffle, pumpkin and tart
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE);
f1 f2
1 Pumpkin soup with cheese bread
7 This row contains only cheese
10 This row contains pumpkin and cheese
12 This row contains both souffle and cheese
13 This row contains both tart and cheese
15 This row contains all four cheese, souffle, pumpkin and tart
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE);
f1 f2
1 Pumpkin soup with cheese bread
10 This row contains pumpkin and cheese
15 This row contains all four cheese, souffle, pumpkin and tart
7 This row contains only cheese
12 This row contains both souffle and cheese
13 This row contains both tart and cheese
6 This row contains only pumpkin
8 This row contains pumpkin and souffle
9 This row contains pumpkin and tart
14 This row contains all three souffle, pumpkin and tart
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE);
f1 f2
8 This row contains pumpkin and souffle
14 This row contains all three souffle, pumpkin and tart
15 This row contains all four cheese, souffle, pumpkin and tart
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
f1 f2
14 This row contains all three souffle, pumpkin and tart
15 This row contains all four cheese, souffle, pumpkin and tart
8 This row contains pumpkin and souffle
9 This row contains pumpkin and tart
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE);
f1 f2
8 This row contains pumpkin and souffle
14 This row contains all three souffle, pumpkin and tart
15 This row contains all four cheese, souffle, pumpkin and tart
9 This row contains pumpkin and tart
SELECT * FROM t1 WHERE MATCH(f2)
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
f1 f2
14 This row contains all three souffle, pumpkin and tart
15 This row contains all four cheese, souffle, pumpkin and tart
8 This row contains pumpkin and souffle
9 This row contains pumpkin and tart
DROP TABLE t1;
--innodb_ft_index_cache
\ No newline at end of file
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