create table documents ( docid int not null auto_increment primary key, title varchar(255) null, doctext text, fulltext index (text) ); select title,doctext from documents where match(doctext) against ('perl') or match(doctext) against ('monger') and not match(doctext) against ('java');