# Copyright(C) 2012 Kentoku SHIBA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

--source ../../../../include/mroonga/have_mariadb.inc
--source ../../../../include/mroonga/have_innodb.inc
--source ../../../../include/mroonga/have_mroonga.inc

--disable_warnings
DROP TABLE IF EXISTS diaries;
--enable_warnings

SET NAMES UTF8MB4;
CREATE TABLE ft(
  a INT DEFAULT 0,
  b TEXT,
  c TEXT,
  PRIMARY KEY(a),
  FULLTEXT KEY ftx1(b),
  FULLTEXT KEY ftx2(c)
)ENGINE=Mroonga DEFAULT CHARSET=UTF8MB4 COMMENT = 'engine "innodb"';

INSERT INTO ft VALUES(1,'aaaaa','abcde');
INSERT INTO ft VALUES(2,'bbbbb','bcdef');
INSERT INTO ft VALUES(3,'ccccc','cdefg');
INSERT INTO ft VALUES(4,'ddddd','defgh');
INSERT INTO ft VALUES(5,'eeeee','efghi');

SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE);
SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE);

DROP TABLE ft;

--source ../../../../include/mroonga/have_mroonga_deinit.inc
