Kouhei Sutou
null+****@clear*****
Wed Jun 12 12:40:42 JST 2013
Kouhei Sutou 2013-06-12 12:40:42 +0900 (Wed, 12 Jun 2013) New Revision: eaafa38d0cbcf3d7007fab0cb2c2470c831e6cde https://github.com/groonga/groonga/commit/eaafa38d0cbcf3d7007fab0cb2c2470c831e6cde Message: Fix a bug that wrong tag name is used in XML output It is caused when "REFERENCE_VECTOR_COLUMN._key" is used in output_columns. See a test case for XML output for details. Added files: test/command/suite/select/output_columns/vector/reference/key/json.expected test/command/suite/select/output_columns/vector/reference/key/json.test test/command/suite/select/output_columns/vector/reference/key/xml.expected test/command/suite/select/output_columns/vector/reference/key/xml.test Modified files: lib/output.c Modified: lib/output.c (+1 -1) =================================================================== --- lib/output.c 2013-06-12 12:38:05 +0900 (0551ea5) +++ lib/output.c 2013-06-12 12:40:42 +0900 (8116663) @@ -542,7 +542,7 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, grn_obj_get_value(ctx, a->obj, id, &buf); idp = (grn_id *)GRN_BULK_HEAD(&buf); vs = GRN_BULK_VSIZE(&buf) / sizeof(grn_id); - grn_output_array_open(ctx, outbuf, output_type, "COLUMN", vs); + grn_output_array_open(ctx, outbuf, output_type, "VECTOR", vs); for (; vs--; idp++) { grn_text_atoj(ctx, outbuf, output_type, (grn_obj *)a->next, *idp); } Added: test/command/suite/select/output_columns/vector/reference/key/json.expected (+43 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/output_columns/vector/reference/key/json.expected 2013-06-12 12:40:42 +0900 (40fc8d2) @@ -0,0 +1,43 @@ +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +table_create Bookmarks TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Bookmarks users COLUMN_VECTOR Users +[[0,0.0,0.0],true] +load --table Bookmarks +[ +{"_key": "http://groonga.org/", "users": ["mori", "s-yata"]} +] +[[0,0.0,0.0],1] +select Bookmarks --output_columns _key,users._key +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "users._key", + "ShortText" + ] + ], + [ + "http://groonga.org/", + [ + "mori", + "s-yata" + ] + ] + ] + ] +] Added: test/command/suite/select/output_columns/vector/reference/key/json.test (+11 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/output_columns/vector/reference/key/json.test 2013-06-12 12:40:42 +0900 (008a269) @@ -0,0 +1,11 @@ +table_create Users TABLE_HASH_KEY ShortText + +table_create Bookmarks TABLE_HASH_KEY ShortText +column_create Bookmarks users COLUMN_VECTOR Users + +load --table Bookmarks +[ +{"_key": "http://groonga.org/", "users": ["mori", "s-yata"]} +] + +select Bookmarks --output_columns _key,users._key Added: test/command/suite/select/output_columns/vector/reference/key/xml.expected (+27 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/output_columns/vector/reference/key/xml.expected 2013-06-12 12:40:42 +0900 (50c53ae) @@ -0,0 +1,27 @@ +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +table_create Bookmarks TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Bookmarks users COLUMN_VECTOR Users +[[0,0.0,0.0],true] +load --table Bookmarks +[ +{"_key": "http://groonga.org/", "users": ["mori", "s-yata"]} +] +[[0,0.0,0.0],1] +select Bookmarks --output_columns _key,users._key --output_type xml +<?xml version="1.0" encoding="utf-8"?> +<SEGMENTS> +<SEGMENT> +<RESULTPAGE> +<RESULTSET OFFSET="0" LIMIT="1" NHITS="1"> +<HIT NO="1"> +<FIELD NAME="_key">http://groonga.org/</FIELD> +<FIELD NAME="users._key">mori, s-yata</FIELD> +</HIT> +</RESULTSET> +</RESULTPAGE> +</SEGMENT> +</SEGMENTS> + + Added: test/command/suite/select/output_columns/vector/reference/key/xml.test (+11 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/output_columns/vector/reference/key/xml.test 2013-06-12 12:40:42 +0900 (c63e5dc) @@ -0,0 +1,11 @@ +table_create Users TABLE_HASH_KEY ShortText + +table_create Bookmarks TABLE_HASH_KEY ShortText +column_create Bookmarks users COLUMN_VECTOR Users + +load --table Bookmarks +[ +{"_key": "http://groonga.org/", "users": ["mori", "s-yata"]} +] + +select Bookmarks --output_columns _key,users._key --output_type xml -------------- next part -------------- HTML����������������������������...Download