| 1 |
# |
| 2 |
# Bug #20028323 INNODB FULLTEXT BOOLEAN SEARCH INCORRECTLY HANDLES |
| 3 |
# PARENTHESES |
| 4 |
# |
| 5 |
CREATE TABLE t1 ( |
| 6 |
f1 INT NOT NULL AUTO_INCREMENT, |
| 7 |
f2 TEXT NOT NULL, |
| 8 |
PRIMARY KEY (f1), |
| 9 |
FULLTEXT (f2) |
| 10 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 11 |
Warnings: |
| 12 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 13 |
INSERT INTO t1 (f2) VALUES |
| 14 |
('Pumpkin soup with cheese bread'), |
| 15 |
('Yellow chicken curry'), |
| 16 |
('Fresh green vegetables with garlic'); |
| 17 |
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE); |
| 18 |
f1 f2 |
| 19 |
1 Pumpkin soup with cheese bread |
| 20 |
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE); |
| 21 |
f1 f2 |
| 22 |
1 Pumpkin soup with cheese bread |
| 23 |
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE); |
| 24 |
f1 f2 |
| 25 |
1 Pumpkin soup with cheese bread |
| 26 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 27 |
AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE); |
| 28 |
f1 f2 |
| 29 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 30 |
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE); |
| 31 |
f1 f2 |
| 32 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 33 |
AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE); |
| 34 |
f1 f2 |
| 35 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 36 |
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE); |
| 37 |
f1 f2 |
| 38 |
INSERT INTO t1 (f2) VALUES |
| 39 |
('This row contains only souffle'), |
| 40 |
('This row contains only tart'), |
| 41 |
('This row contains only pumpkin'), |
| 42 |
('This row contains only cheese'), |
| 43 |
('This row contains pumpkin and souffle'), |
| 44 |
('This row contains pumpkin and tart'), |
| 45 |
('This row contains pumpkin and cheese'), |
| 46 |
('This row contains both souffle and tart'), |
| 47 |
('This row contains both souffle and cheese'), |
| 48 |
('This row contains both tart and cheese'), |
| 49 |
('This row contains all three souffle, pumpkin and tart'), |
| 50 |
('This row contains all four cheese, souffle, pumpkin and tart'); |
| 51 |
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE); |
| 52 |
f1 f2 |
| 53 |
1 Pumpkin soup with cheese bread |
| 54 |
6 This row contains only pumpkin |
| 55 |
8 This row contains pumpkin and souffle |
| 56 |
9 This row contains pumpkin and tart |
| 57 |
10 This row contains pumpkin and cheese |
| 58 |
14 This row contains all three souffle, pumpkin and tart |
| 59 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 60 |
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE); |
| 61 |
f1 f2 |
| 62 |
1 Pumpkin soup with cheese bread |
| 63 |
7 This row contains only cheese |
| 64 |
10 This row contains pumpkin and cheese |
| 65 |
12 This row contains both souffle and cheese |
| 66 |
13 This row contains both tart and cheese |
| 67 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 68 |
SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE); |
| 69 |
f1 f2 |
| 70 |
1 Pumpkin soup with cheese bread |
| 71 |
10 This row contains pumpkin and cheese |
| 72 |
12 This row contains both souffle and cheese |
| 73 |
13 This row contains both tart and cheese |
| 74 |
14 This row contains all three souffle, pumpkin and tart |
| 75 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 76 |
6 This row contains only pumpkin |
| 77 |
7 This row contains only cheese |
| 78 |
8 This row contains pumpkin and souffle |
| 79 |
9 This row contains pumpkin and tart |
| 80 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 81 |
AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE); |
| 82 |
f1 f2 |
| 83 |
8 This row contains pumpkin and souffle |
| 84 |
14 This row contains all three souffle, pumpkin and tart |
| 85 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 86 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 87 |
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE); |
| 88 |
f1 f2 |
| 89 |
14 This row contains all three souffle, pumpkin and tart |
| 90 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 91 |
8 This row contains pumpkin and souffle |
| 92 |
9 This row contains pumpkin and tart |
| 93 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 94 |
AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE); |
| 95 |
f1 f2 |
| 96 |
14 This row contains all three souffle, pumpkin and tart |
| 97 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 98 |
8 This row contains pumpkin and souffle |
| 99 |
9 This row contains pumpkin and tart |
| 100 |
SELECT * FROM t1 WHERE MATCH(f2) |
| 101 |
AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE); |
| 102 |
f1 f2 |
| 103 |
14 This row contains all three souffle, pumpkin and tart |
| 104 |
15 This row contains all four cheese, souffle, pumpkin and tart |
| 105 |
8 This row contains pumpkin and souffle |
| 106 |
9 This row contains pumpkin and tart |
| 107 |
DROP TABLE t1; |