Kouhei Sutou
null+****@clear*****
Tue Nov 18 22:34:15 JST 2014
Kouhei Sutou 2014-11-18 22:34:15 +0900 (Tue, 18 Nov 2014) New Revision: 368d118e51204df18c06b56d6f48b8df9e01fed9 https://github.com/groonga/groonga/commit/368d118e51204df18c06b56d6f48b8df9e01fed9 Message: select: fix a bug that drilldown value can't be got with --filter We should not unlink search result table (temporary table) in grn_obj_get_value(). Added files: test/command/suite/select/drilldown/labeled/with_filter/multiple.expected test/command/suite/select/drilldown/labeled/with_filter/multiple.test Modified files: lib/db.c Modified: lib/db.c (+0 -1) =================================================================== --- lib/db.c 2014-11-18 22:32:31 +0900 (0b387a9) +++ lib/db.c 2014-11-18 22:34:15 +0900 (ef75f22) @@ -6136,7 +6136,6 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value) processed = GRN_TRUE; } } - grn_obj_unlink(ctx, domain); } if (!processed) { grn_hash *hash = (grn_hash *)obj; Added: test/command/suite/select/drilldown/labeled/with_filter/multiple.expected (+121 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/drilldown/labeled/with_filter/multiple.expected 2014-11-18 22:34:15 +0900 (ca9a4cb) @@ -0,0 +1,121 @@ +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos date COLUMN_SCALAR Time +[[0,0.0,0.0],true] +load --table Memos +[ +{"_key": "Groonga is fast!", "tag": "Groonga", "date": "2014-11-16 00:00:00"}, +{"_key": "Mroonga is fast!", "tag": "Mroonga", "date": "2014-11-16 00:00:00"}, +{"_key": "Groonga sticker!", "tag": "Groonga", "date": "2014-11-16 00:00:00"}, +{"_key": "Rroonga is fast!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"}, +{"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"} +] +[[0,0.0,0.0],5] +select Memos --filter true --drilldown[tag].keys tag,date --drilldown[tag].output_columns tag,date,_nsubrecs +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 5 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "date", + "Time" + ], + [ + "tag", + "Tags" + ] + ], + [ + 1, + "Groonga is fast!", + 1416063600.0, + "Groonga" + ], + [ + 2, + "Mroonga is fast!", + 1416063600.0, + "Mroonga" + ], + [ + 3, + "Groonga sticker!", + 1416063600.0, + "Groonga" + ], + [ + 4, + "Rroonga is fast!", + 1416150000.0, + "Rroonga" + ], + [ + 5, + "Groonga is good!", + 1416150000.0, + "Groonga" + ] + ], + { + "tag": [ + [ + 4 + ], + [ + [ + "tag", + "Tags" + ], + [ + "date", + "Time" + ], + [ + "_nsubrecs", + "Int32" + ] + ], + [ + "Groonga", + 1416063600.0, + 2 + ], + [ + "Mroonga", + 1416063600.0, + 1 + ], + [ + "Rroonga", + 1416150000.0, + 1 + ], + [ + "Groonga", + 1416150000.0, + 1 + ] + ] + } + ] +] Added: test/command/suite/select/drilldown/labeled/with_filter/multiple.test (+19 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/drilldown/labeled/with_filter/multiple.test 2014-11-18 22:34:15 +0900 (5ffe1bd) @@ -0,0 +1,19 @@ +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos TABLE_HASH_KEY ShortText +column_create Memos tag COLUMN_SCALAR Tags +column_create Memos date COLUMN_SCALAR Time + +load --table Memos +[ +{"_key": "Groonga is fast!", "tag": "Groonga", "date": "2014-11-16 00:00:00"}, +{"_key": "Mroonga is fast!", "tag": "Mroonga", "date": "2014-11-16 00:00:00"}, +{"_key": "Groonga sticker!", "tag": "Groonga", "date": "2014-11-16 00:00:00"}, +{"_key": "Rroonga is fast!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"}, +{"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"} +] + +select Memos \ + --filter true \ + --drilldown[tag].keys tag,date \ + --drilldown[tag].output_columns tag,date,_nsubrecs -------------- next part -------------- HTML����������������������������... 다운로드