2001-01-03 01:15:48 +01:00
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
2000-12-11 14:09:31 +01:00
a INT AUTO_INCREMENT PRIMARY KEY,
message CHAR(20),
FULLTEXT(message)
2000-12-12 13:17:29 +01:00
) comment = 'original testcase by sroussey@network54.com';
2001-01-03 01:15:48 +01:00
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
2000-12-11 14:09:31 +01:00
("steve"),("is"),("cool"),("steve is cool");
2000-12-12 13:17:29 +01:00
# basic MATCH
2001-01-03 01:15:48 +01:00
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
2001-11-22 16:00:11 +01:00
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
2000-12-30 16:24:31 +01:00
2000-12-15 00:09:53 +01:00
# MATCH + ORDER BY (with ft-ranges)
2001-01-03 01:15:48 +01:00
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
2001-11-22 16:00:11 +01:00
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
2000-12-30 16:24:31 +01:00
2000-12-15 00:09:53 +01:00
# MATCH + ORDER BY (with normal ranges) + UNIQUE
2001-01-03 01:15:48 +01:00
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
2001-11-22 16:00:11 +01:00
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
2000-12-30 16:24:31 +01:00
2000-12-12 13:17:29 +01:00
# MATCH + ORDER BY + UNIQUE (const_table)
2001-01-03 01:15:48 +01:00
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
2001-11-22 16:00:11 +01:00
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
2000-12-30 16:24:31 +01:00
2000-12-12 13:17:29 +01:00
# ORDER BY MATCH
2001-01-03 01:15:48 +01:00
SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
2001-11-22 16:00:11 +01:00
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
2001-01-03 01:15:48 +01:00
drop table t1;
2002-09-17 21:04:10 +02:00
#
# reused boolean scan bug
#
CREATE TABLE t1 (
a INT AUTO_INCREMENT PRIMARY KEY,
message CHAR(20),
FULLTEXT(message)
);
INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
drop table t1;