Kouhei Sutou
null+****@clear*****
Wed Nov 19 19:12:42 JST 2014
Kouhei Sutou 2014-11-19 19:12:42 +0900 (Wed, 19 Nov 2014) New Revision: 05d028ace33e48fe8da299e09ad41d3e2abaa0d1 https://github.com/groonga/groonga/commit/05d028ace33e48fe8da299e09ad41d3e2abaa0d1 Message: range_filter: support default min_border Added files: test/command/suite/range_filter/min_border/default.expected test/command/suite/range_filter/min_border/default.test Modified files: lib/proc.c Modified: lib/proc.c (+5 -1) =================================================================== --- lib/proc.c 2014-11-19 19:10:42 +0900 (66f1f4c) +++ lib/proc.c 2014-11-19 19:12:42 +0900 (3795c77) @@ -6285,7 +6285,11 @@ proc_range_filter(grn_ctx *ctx, int nargs, grn_obj **args, } else { table_cursor_flags |= GRN_CURSOR_ASCENDING; } - min_border_type = between_parse_border(ctx, min_border, "min_border"); + if (GRN_TEXT_LEN(min_border) > 0) { + min_border_type = between_parse_border(ctx, min_border, "min_border"); + } else { + min_border_type = BETWEEN_BORDER_INCLUDE; + } max_border_type = between_parse_border(ctx, max_border, "max_border"); if (min_border_type == BETWEEN_BORDER_EXCLUDE) { table_cursor_flags |= GRN_CURSOR_GT; Added: test/command/suite/range_filter/min_border/default.expected (+51 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/range_filter/min_border/default.expected 2014-11-19 19:12:42 +0900 (95cc062) @@ -0,0 +1,51 @@ +table_create Memos TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Memos id COLUMN_SCALAR Int32 +[[0,0.0,0.0],true] +column_create Memos text COLUMN_SCALAR Text +[[0,0.0,0.0],true] +table_create IDs TABLE_PAT_KEY Int32 +[[0,0.0,0.0],true] +column_create IDs memos_id COLUMN_INDEX Memos id +[[0,0.0,0.0],true] +load --table Memos +[ +{"id": 0, "text": "aaa"}, +{"id": 1, "text": "aab"}, +{"id": 2, "text": "aac"} +] +[[0,0.0,0.0],3] +range_filter Memos id --min 1 --max 10 --max_border exclude +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "_id", + "UInt32" + ], + [ + "id", + "Int32" + ], + [ + "text", + "Text" + ] + ], + [ + 2, + 1, + "aab" + ], + [ + 3, + 2, + "aac" + ] + ] +] Added: test/command/suite/range_filter/min_border/default.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/range_filter/min_border/default.test 2014-11-19 19:12:42 +0900 (1703b09) @@ -0,0 +1,17 @@ +table_create Memos TABLE_NO_KEY +column_create Memos id COLUMN_SCALAR Int32 +column_create Memos text COLUMN_SCALAR Text + +table_create IDs TABLE_PAT_KEY Int32 +column_create IDs memos_id COLUMN_INDEX Memos id + +load --table Memos +[ +{"id": 0, "text": "aaa"}, +{"id": 1, "text": "aab"}, +{"id": 2, "text": "aac"} +] + +range_filter Memos id \ + --min 1 \ + --max 10 --max_border exclude -------------- next part -------------- HTML����������������������������... Download