2000-12-11 14:09:31 +01:00
|
|
|
use test;
|
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');
|
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;
|
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;
|
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;
|
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;
|
|
|
|
|
|
|
|
drop table t1;
|