mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge work:/home/bk/mysql
into mysql.sashanet.com:/home/sasha/src/bk/mysql
This commit is contained in:
38
mysql-test/t/fulltext_join.test
Normal file
38
mysql-test/t/fulltext_join.test
Normal file
@ -0,0 +1,38 @@
|
||||
DROP TABLE IF EXISTS stories;
|
||||
CREATE TABLE stories (
|
||||
sid char(16) NOT NULL,
|
||||
tid smallint UNSIGNED NOT NULL,
|
||||
uid mediumint UNSIGNED NOT NULL,
|
||||
title varchar(100) DEFAULT '' NOT NULL,
|
||||
dept varchar(100),
|
||||
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
|
||||
hits mediumint UNSIGNED DEFAULT '0' NOT NULL,
|
||||
section varchar(30) DEFAULT '' NOT NULL,
|
||||
displaystatus tinyint DEFAULT '0' NOT NULL,
|
||||
commentstatus tinyint,
|
||||
discussion mediumint UNSIGNED,
|
||||
submitter mediumint UNSIGNED NOT NULL,
|
||||
flags set("delete_me","data_dirty") DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (sid),
|
||||
FOREIGN KEY (uid) REFERENCES users(uid),
|
||||
FOREIGN KEY (tid) REFERENCES tid(topic),
|
||||
FOREIGN KEY (section) REFERENCES sections(section),
|
||||
KEY time (time),
|
||||
KEY searchform (displaystatus,time)
|
||||
) TYPE = myisam;
|
||||
DROP TABLE IF EXISTS story_text;
|
||||
CREATE TABLE story_text (
|
||||
sid char(16) NOT NULL,
|
||||
introtext text,
|
||||
bodytext text,
|
||||
relatedtext text,
|
||||
FOREIGN KEY (sid) REFERENCES stories(sid),
|
||||
PRIMARY KEY (sid)
|
||||
) TYPE = myisam;
|
||||
ALTER TABLE stories add fulltext (title);
|
||||
ALTER TABLE story_text add fulltext (introtext,bodytext);
|
||||
|
||||
SELECT stories.sid,title, TRUNCATE((MATCH (title,introtext,bodytext)
|
||||
AGAINST('install')), 1) as score FROM stories,story_text WHERE
|
||||
stories.sid = story_text.sid AND MATCH (title,introtext,bodytext)
|
||||
AGAINST ('install');
|
Reference in New Issue
Block a user