Kouhei Sutou
null+****@clear*****
Wed Mar 11 14:06:54 JST 2015
Kouhei Sutou 2015-03-11 14:06:54 +0900 (Wed, 11 Mar 2015) New Revision: 331bce0ff9ebac857e737a615a60950d6a54e87c https://github.com/groonga/groonga/commit/331bce0ff9ebac857e737a615a60950d6a54e87c Message: plugin_register: add "register" command is deprecated. Added files: test/command/suite/plugin_register/existence.expected test/command/suite/plugin_register/existence.test Modified files: lib/proc.c Modified: lib/proc.c (+20 -0) =================================================================== --- lib/proc.c 2015-03-11 14:02:53 +0900 (bbfcfd1) +++ lib/proc.c 2015-03-11 14:06:54 +0900 (433ad8e) @@ -6432,6 +6432,22 @@ proc_request_cancel(grn_ctx *ctx, int nargs, grn_obj **args, } static grn_obj * +proc_plugin_register(grn_ctx *ctx, int nargs, grn_obj **args, + grn_user_data *user_data) +{ + if (GRN_TEXT_LEN(VAR(0))) { + const char *name; + GRN_TEXT_PUTC(ctx, VAR(0), '\0'); + name = GRN_TEXT_VALUE(VAR(0)); + grn_plugin_register(ctx, name); + } else { + ERR(GRN_INVALID_ARGUMENT, "[plugin_register] name is missing"); + } + GRN_OUTPUT_BOOL(!ctx->rc); + return NULL; +} + +static grn_obj * proc_plugin_unregister(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) { @@ -6575,6 +6591,7 @@ grn_db_init_builtin_query(grn_ctx *ctx) DEF_VAR(vars[0], "tables"); DEF_COMMAND("dump", proc_dump, 1, vars); + /* Deprecated. Use "plugin_register" instead. */ DEF_VAR(vars[0], "path"); DEF_COMMAND("register", proc_register, 1, vars); @@ -6716,5 +6733,8 @@ grn_db_init_builtin_query(grn_ctx *ctx) DEF_COMMAND("request_cancel", proc_request_cancel, 1, vars); DEF_VAR(vars[0], "name"); + DEF_COMMAND("plugin_register", proc_plugin_register, 1, vars); + + DEF_VAR(vars[0], "name"); DEF_COMMAND("plugin_unregister", proc_plugin_unregister, 1, vars); } Added: test/command/suite/plugin_register/existence.expected (+42 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/plugin_register/existence.expected 2015-03-11 14:06:54 +0900 (4373473) @@ -0,0 +1,42 @@ +plugin_register "query_expanders/tsv" +[[0,0.0,0.0],true] +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] +load --table Memos +[ +["content"], +["Start Rroonga!"], +["Start Ruby and Mroonga!"] +] +[[0,0.0,0.0],2] +select --table Memos --query_expander QueryExpanderTSV --match_columns content --query rroonga +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "content", + "ShortText" + ] + ], + [ + 1, + "Start Rroonga!" + ] + ] + ] +] Added: test/command/suite/plugin_register/existence.test (+15 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/plugin_register/existence.test 2015-03-11 14:06:54 +0900 (3e9c8e9) @@ -0,0 +1,15 @@ +#@copy-path fixture/query_expander/tsv/expand.tsv tmp/synonyms.tsv +plugin_register "query_expanders/tsv" + +table_create Memos TABLE_NO_KEY +column_create Memos content COLUMN_SCALAR ShortText + +load --table Memos +[ +["content"], +["Start Rroonga!"], +["Start Ruby and Groonga!"] +] + +select --table Memos --query_expander QueryExpanderTSV \ + --match_columns content --query rroonga -------------- next part -------------- HTML����������������������������...Download