diff options
Diffstat (limited to 'mysql-test/t/fulltext.test')
-rw-r--r-- | mysql-test/t/fulltext.test | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index bcd27e51f24..3853a224fd5 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -28,6 +28,12 @@ select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION); select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION); select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION); +# IN NATURAL LANGUAGE MODE +select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE); +select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION); +--error 1064 +select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION); + # add_ft_keys() tests explain select * from t1 where MATCH(a,b) AGAINST ("collections"); @@ -355,6 +361,12 @@ SET myisam_repair_threads=@@global.myisam_repair_threads; INSERT INTO t1 VALUES('testword\'\''); SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE); SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); + +# +# BUG#14194: Problem with fulltext boolean search and apostrophe +# +INSERT INTO t1 VALUES('test\'s'); +SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE); DROP TABLE t1; # @@ -395,6 +407,16 @@ INSERT INTO t1 VALUES(' aaaaa aaaa'); SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE); 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); +SELECT a FROM t1 WHERE MATCH a AGAINST ('+city (of*)' IN BOOLEAN MODE); +SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE); +DROP TABLE t1; + # End of 4.1 tests # @@ -442,9 +464,17 @@ SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN DROP TABLE t1; # -# BUG#37740 Server crashes on execute statement with full text search and match against +# BUG#42907 - Multi-term boolean fulltext query containing a single +# quote fails in 5.1.x # +CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)); +INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE); +DROP TABLE t1; +# +# BUG#37740 Server crashes on execute statement with full text search and match against +# CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col)); PREPARE s FROM @@ -455,6 +485,7 @@ EXECUTE s; DEALLOCATE PREPARE s; DROP TABLE t1; + --echo # --echo # Bug #49250 : spatial btree index corruption and crash --echo # Part two : fulltext syntax check @@ -471,4 +502,47 @@ ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1); DROP TABLE t2; + --echo End of 5.0 tests + + +--echo # +--echo # Bug #47930: MATCH IN BOOLEAN MODE returns too many results +--echo # inside subquery +--echo # + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1), (2); + +CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2)); +INSERT INTO t2 VALUES (1,'Scargill'); + +CREATE TABLE t3 (a int, b int); +INSERT INTO t3 VALUES (1,1), (2,1); + +--echo # t2 should use full text index +EXPLAIN +SELECT count(*) FROM t1 WHERE + not exists( + SELECT 1 FROM t2, t3 + WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) + ); + +--echo # should return 0 +SELECT count(*) FROM t1 WHERE + not exists( + SELECT 1 FROM t2, t3 + WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) + ); + +--echo # should return 0 +SELECT count(*) FROM t1 WHERE + not exists( + SELECT 1 FROM t2 IGNORE INDEX (b2), t3 + WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) + ); + +DROP TABLE t1,t2,t3; + + +--echo End of 5.1 tests |