BUG#29445 - match ... against () never returns

Part 1:
Do not perform index search for a plus-word with truncation operator
in case there are other plus-words in expression.

Specifically this optimization was enforced for expression like
"+word1 +word2*", but wasn't enforced for expression like
"+word1 word2*".
parent c1881105
...@@ -480,3 +480,9 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci, ...@@ -480,3 +480,9 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
FULLTEXT(a)); FULLTEXT(a));
INSERT INTO t1 VALUES(0xA3C2); INSERT INTO t1 VALUES(0xA3C2);
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a));
INSERT INTO t1 VALUES('Offside'),('City Of God');
SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE);
a
City Of God
DROP TABLE t1;
...@@ -408,4 +408,12 @@ FULLTEXT(a)); ...@@ -408,4 +408,12 @@ FULLTEXT(a));
INSERT INTO t1 VALUES(0xA3C2); INSERT INTO t1 VALUES(0xA3C2);
DROP TABLE t1; DROP TABLE t1;
#
# BUG#29445 - match ... against () never returns
#
CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a));
INSERT INTO t1 VALUES('Offside'),('City Of God');
SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE);
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -474,7 +474,8 @@ static void _ftb_init_index_search(FT_INFO *ftb) ...@@ -474,7 +474,8 @@ static void _ftb_init_index_search(FT_INFO *ftb)
ftbe->up->flags|= FTB_FLAG_TRUNC, ftbe=ftbe->up) ftbe->up->flags|= FTB_FLAG_TRUNC, ftbe=ftbe->up)
{ {
if (ftbe->flags & FTB_FLAG_NO || /* 2 */ if (ftbe->flags & FTB_FLAG_NO || /* 2 */
ftbe->up->ythresh - ftbe->up->yweaks >1) /* 1 */ ftbe->up->ythresh - ftbe->up->yweaks >
test(ftbe->flags & FTB_FLAG_YES)) /* 1 */
{ {
FTB_EXPR *top_ftbe=ftbe->up; FTB_EXPR *top_ftbe=ftbe->up;
ftbw->docid[0]=HA_OFFSET_ERROR; ftbw->docid[0]=HA_OFFSET_ERROR;
......
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