Kouhei Sutou
null+****@clear*****
Mon Oct 1 17:29:12 JST 2012
Kouhei Sutou 2012-10-01 17:29:12 +0900 (Mon, 01 Oct 2012) New Revision: 30614a23d52332e84d3b04b36bb383157498d608 https://github.com/groonga/groonga/commit/30614a23d52332e84d3b04b36bb383157498d608 Log: test: add a test of the most simple query expanstion Query has only one word and it is just expanded to simple OR. Added files: test/function/suite/select/query_expansion/scalar/one_word.expected test/function/suite/select/query_expansion/scalar/one_word.test test/function/suite/select/query_expansion/vector/one_word.expected test/function/suite/select/query_expansion/vector/one_word.test Added: test/function/suite/select/query_expansion/scalar/one_word.expected (+64 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/query_expansion/scalar/one_word.expected 2012-10-01 17:29:12 +0900 (7b2eb47) @@ -0,0 +1,64 @@ +table_create Memos TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Memos content COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +[[0,0.0,0.0],true] +column_create Lexicon diary_content COLUMN_INDEX|WITH_POSITION Memos content +[[0,0.0,0.0],true] +table_create Synonyms TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Synonyms words COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Memos +[ +["content"], +["Start groonga!"], +["Start mroonga!"], +["Start rroonga!"], +["Start Ruby!"] +] +[[0,0.0,0.0],4] +load --table Synonyms +[ +["_key", "words"], +["groonga", "(groonga OR rroonga OR mroonga)"] +] +[[0,0.0,0.0],1] +select --table Memos --query_expansion Synonyms.words --match_columns content --query groonga +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "content", + "ShortText" + ] + ], + [ + 1, + "Start groonga!" + ], + [ + 3, + "Start rroonga!" + ], + [ + 2, + "Start mroonga!" + ] + ] + ] +] Added: test/function/suite/select/query_expansion/scalar/one_word.test (+26 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/query_expansion/scalar/one_word.test 2012-10-01 17:29:12 +0900 (f532cae) @@ -0,0 +1,26 @@ +table_create Memos TABLE_NO_KEY +column_create Memos content COLUMN_SCALAR ShortText + +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +column_create Lexicon diary_content COLUMN_INDEX|WITH_POSITION Memos content + +table_create Synonyms TABLE_PAT_KEY ShortText +column_create Synonyms words COLUMN_SCALAR ShortText + +load --table Memos +[ +["content"], +["Start groonga!"], +["Start mroonga!"], +["Start rroonga!"], +["Start Ruby!"] +] + +load --table Synonyms +[ +["_key", "words"], +["groonga", "(groonga OR rroonga OR mroonga)"] +] + +select --table Memos --query_expansion Synonyms.words \ + --match_columns content --query groonga Added: test/function/suite/select/query_expansion/vector/one_word.expected (+64 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/query_expansion/vector/one_word.expected 2012-10-01 17:29:12 +0900 (43cd368) @@ -0,0 +1,64 @@ +table_create Memos TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Memos content COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +[[0,0.0,0.0],true] +column_create Lexicon diary_content COLUMN_INDEX|WITH_POSITION Memos content +[[0,0.0,0.0],true] +table_create Synonyms TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Synonyms words COLUMN_VECTOR ShortText +[[0,0.0,0.0],true] +load --table Memos +[ +["content"], +["Start groonga!"], +["Start mroonga!"], +["Start rroonga!"], +["Start Ruby!"] +] +[[0,0.0,0.0],4] +load --table Synonyms +[ +["_key", "words"], +["groonga", ["groonga", "rroonga", "mroonga"]] +] +[[0,0.0,0.0],1] +select --table Memos --query_expansion Synonyms.words --match_columns content --query groonga +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "content", + "ShortText" + ] + ], + [ + 1, + "Start groonga!" + ], + [ + 3, + "Start rroonga!" + ], + [ + 2, + "Start mroonga!" + ] + ] + ] +] Added: test/function/suite/select/query_expansion/vector/one_word.test (+26 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/query_expansion/vector/one_word.test 2012-10-01 17:29:12 +0900 (2d0b79d) @@ -0,0 +1,26 @@ +table_create Memos TABLE_NO_KEY +column_create Memos content COLUMN_SCALAR ShortText + +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +column_create Lexicon diary_content COLUMN_INDEX|WITH_POSITION Memos content + +table_create Synonyms TABLE_PAT_KEY ShortText +column_create Synonyms words COLUMN_VECTOR ShortText + +load --table Memos +[ +["content"], +["Start groonga!"], +["Start mroonga!"], +["Start rroonga!"], +["Start Ruby!"] +] + +load --table Synonyms +[ +["_key", "words"], +["groonga", ["groonga", "rroonga", "mroonga"]] +] + +select --table Memos --query_expansion Synonyms.words \ + --match_columns content --query groonga -------------- next part -------------- HTML����������������������������...Download