This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE t (id INT, c VARCHAR(255), FULLTEXT (c) WITH PARSER thaift_parser) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
insert into t(id, c) values(1, 'อกุศลวิตก (unwholesome thought; akusala vitaka)'), (2, 'อกุศล (unwholesome; akusala)'), (3, 'วิตก (thought; vitaka)'); | |
select id from t where match c against ('วิตก' in boolean mode); #expect 1,3 | |
select id from t where match c against ('อกุศล' in boolean mode); #expect 1,2 | |
select id from t where match c against ('+วิตก +akusala' in boolean mode); #expect 1 | |
select id from t where match c against ('+วิตก +อกุศล' in boolean mode); #expect 1 | |
select id from t where match c against ('+วิตก akusala' in boolean mode); #expect 1,3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# Word segmentation test ############################# | |
DROP TABLE IF EXISTS t; | |
CREATE TABLE t (id INT, c VARCHAR(255), FULLTEXT (c) WITH PARSER thaift_parser) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO t(id, c) VALUES | |
(1, 'กฎหมาย'), | |
(2, 'มีหมาอยู่ในบ้าน'); | |
SELECT id, c FROM t WHERE MATCH(c) AGAINST('หมา'); # expect (2) | |