Begin;
Initialize;

InitializeSession "TEST";
Command "create database TEST";
Command "create table T(ID int, F nvarchar(512), primary key(ID))";
Command "create fulltext index T_F on T(F) hint 'inverted=(indexing=dual, tokenizer=DUAL:JAP:ALL:2 @UNARSCID:1 @NORMRSCID:1)'";

Command "insert into T values (1, 'リコーの環境への取り組み')";
Command "insert into T values (2, '低炭素社会をめざすシャープ')";

# それぞれ1件づつヒットする
Command "select id, score(F) from T where F contains within('リコー' synonym('環境' 'エコ')asymmetric upper 10)";
Command "select id, score(F) from T where F contains within('シャ' synonym('低' '文') asymmetric upper 10)";
Command "select id, score(F) from T where F contains within(synonym('低炭素' '文学的') 'シ' asymmetric upper 10)";

Command "select id, score(F) from T where F contains within(synonym('環境' 'エコ' '取り') 'リコー' asymmetric upper 10)";
Command "select id, score(F) from T where F contains within(synonym('低' '文' '美') 'シャ' asymmetric upper 10)";
Command "select id, score(F) from T where F contains within('シ' synonym('低炭素' '文学的' '社会') asymmetric upper 10)";

Command "select id, score(F) from T where F contains within('リコー' synonym('環境' 'エコ') synonym('取り' '取れ') asymmetric upper 10)";
Command "select id, score(F) from T where F contains within('シャ' synonym('低' '文') synonym('プ' 'ペ') asymmetric upper 14)";
Command "select id, score(F) from T where F contains within(synonym('低炭素' '文学的') synonym('社会' '会社') 'シ' asymmetric upper 10)";

# 以下の3つは何もヒットしない
Command "select id, score(F) from T where F contains within(synonym('患境' 'エコ') 'リコー' asymmetric upper 10)";
Command "select id, score(F) from T where F contains within(synonym('高' '文') 'シャ' asymmetric upper 10)";
Command "select id, score(F) from T where F contains within('シ' synonym('高酸素' '文学的') asymmetric upper 10)";

Command "drop database TEST";

TerminateSession;
Terminate;
End;
