diff options
Diffstat (limited to 'storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test')
-rw-r--r-- | storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test new file mode 100644 index 00000000000..42b621f4401 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test @@ -0,0 +1,49 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE logs( + message TEXT, + host TEXT, + FULLTEXT KEY (message), + FULLTEXT KEY (host) +) DEFAULT CHARSET=utf8; + +INSERT INTO logs VALUES("Error Error Error", "host1"); +INSERT INTO logs VALUES("Warning Warning Warning", "host1"); +INSERT INTO logs VALUES("Error Error", "host2"); +INSERT INTO logs VALUES("Warning Warning", "host2"); +INSERT INTO logs VALUES("Error", "host2"); +INSERT INTO logs VALUES("Warning", "host2"); +INSERT INTO logs VALUES("Error Error Error Error", "host2"); +INSERT INTO logs VALUES("Warning Warning Warning Warning", "host2"); + +SELECT * FROM logs; + +SELECT *, MATCH(host) AGAINST("host2" IN NATURAL LANGUAGE MODE) AS score + FROM logs + WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) + ORDER BY MATCH(host) AGAINST("host2" IN NATURAL LANGUAGE MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc |