mariadb/mysql-test/suite/innodb_fts/r/subexpr.result
Marko Mäkelä 228b7e4db5 MDEV-13626 Merge InnoDB test cases from MySQL 5.7
This imports and adapts a number of MySQL 5.7 test cases that are
applicable to MariaDB.

Some tests for old bug fixes are not that relevant because the code
has been refactored since then (especially starting with
MariaDB Server 10.6), and the tests would not reproduce the
original bug if the fix was reverted.

In the test innodb_fts.opt, there are many duplicate MATCH ranks, which
would make the results nondeterministic. The test was stabilized by
changing some LIMIT clauses or by adding sorted_result in those cases
where the purpose of a test was to show that no sorting took place
in the server.

In the test innodb_fts.phrase, MySQL 5.7 would generate FTS_DOC_ID that
are 1 larger than in MariaDB. In innodb_fts.index_table the difference is 2.
This is because in MariaDB, fts_get_next_doc_id() post-increments
cache->next_doc_id, while MySQL 5.7 pre-increments it.

Reviewed by: Thirunarayanan Balathandayuthapani
2023-11-08 12:17:14 +02:00

105 lines
3.9 KiB
Text

#
# 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;