Kouhei Sutou
null+****@clear*****
Mon Aug 12 19:09:09 JST 2013
Kouhei Sutou 2013-08-12 19:09:09 +0900 (Mon, 12 Aug 2013) New Revision: f363b064ccd940408eef4a0614b13095f38c5394 https://github.com/groonga/groonga/commit/f363b064ccd940408eef4a0614b13095f38c5394 Message: select: fix a bug that nested match operation after AND operator doesn't work The following filter pattern is the problem case: select ... --filter '... && nested.column @ "keyword"' [groonga-dev,01599] Reported by Motoi Washida. Thanks!!! Added files: test/command/suite/select/index/nested/by_column/match/and.expected test/command/suite/select/index/nested/by_column/match/and.test Modified files: lib/db.c Modified: lib/db.c (+1 -1) =================================================================== --- lib/db.c 2013-08-12 17:55:13 +0900 (ba00fe9) +++ lib/db.c 2013-08-12 19:09:09 +0900 (2a4f7ab) @@ -2681,7 +2681,7 @@ grn_obj_search_accessor(grn_ctx *ctx, grn_obj *obj, grn_obj *query, if (!base_res) { goto exit; } - rc = grn_obj_search(ctx, index, query, base_res, op, optarg); + rc = grn_obj_search(ctx, index, query, base_res, GRN_OP_OR, optarg); if (rc != GRN_SUCCESS) { grn_obj_unlink(ctx, base_res); goto exit; Added: test/command/suite/select/index/nested/by_column/match/and.expected (+62 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/nested/by_column/match/and.expected 2013-08-12 19:09:09 +0900 (f35d3c1) @@ -0,0 +1,62 @@ +table_create Users TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Users hobby COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Files TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Files owner COLUMN_SCALAR Users +[[0,0.0,0.0],true] +column_create Users files_owner_index COLUMN_INDEX Files owner +[[0,0.0,0.0],true] +table_create Hobbies TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Hobbies users_hobby COLUMN_INDEX Users hobby +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "hobby": "programming"}, +{"_key": "Bob", "hobby": "system administration"}, +{"_key": "Carlos", "hobby": "running"} +] +[[0,0.0,0.0],3] +load --table Files +[ +{"_key": "/home/alice/.zshrc", "owner": "Alice"}, +{"_key": "/home/bob/.bashrc", "owner": "Bob"}, +{"_key": "/home/calros/public_html/index.html", "owner": "Carlos"} +] +[[0,0.0,0.0],3] +select Files --filter '_key @^ "/home/" && owner.hobby @ "programming"' --output_columns '_key, owner, owner.hobby' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "owner", + "Users" + ], + [ + "owner.hobby", + "ShortText" + ] + ], + [ + "/home/alice/.zshrc", + "Alice", + "programming" + ] + ] + ] +] Added: test/command/suite/select/index/nested/by_column/match/and.test (+28 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/nested/by_column/match/and.test 2013-08-12 19:09:09 +0900 (d2fd505) @@ -0,0 +1,28 @@ +table_create Users TABLE_PAT_KEY ShortText +column_create Users hobby COLUMN_SCALAR ShortText + +table_create Files TABLE_PAT_KEY ShortText +column_create Files owner COLUMN_SCALAR Users + +column_create Users files_owner_index COLUMN_INDEX Files owner + +table_create Hobbies TABLE_PAT_KEY ShortText +column_create Hobbies users_hobby COLUMN_INDEX Users hobby + +load --table Users +[ +{"_key": "Alice", "hobby": "programming"}, +{"_key": "Bob", "hobby": "system administration"}, +{"_key": "Carlos", "hobby": "running"} +] + +load --table Files +[ +{"_key": "/home/alice/.zshrc", "owner": "Alice"}, +{"_key": "/home/bob/.bashrc", "owner": "Bob"}, +{"_key": "/home/calros/public_html/index.html", "owner": "Carlos"} +] + +select Files \ + --filter '_key @^ "/home/" && owner.hobby @ "programming"' \ + --output_columns '_key, owner, owner.hobby' -------------- next part -------------- HTML����������������������������...Download