Kouhei Sutou 2018-10-25 20:52:32 +0900 (Thu, 25 Oct 2018) Revision: 5c3f01c423a3faef860a75936d19e7f448c4ab0b https://github.com/groonga/groonga/commit/5c3f01c423a3faef860a75936d19e7f448c4ab0b Message: table_list: support default tokenizer option Added files: test/command/suite/table_list/default_tokenizer/option.expected test/command/suite/table_list/default_tokenizer/option.test Modified files: lib/proc/proc_table.c Modified: lib/proc/proc_table.c (+14 -3) =================================================================== --- lib/proc/proc_table.c 2018-10-25 20:44:58 +0900 (9902cce04) +++ lib/proc/proc_table.c 2018-10-25 20:52:32 +0900 (941407040) @@ -1,6 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2009-2018 Brazil + Copyright(C) 2018 Kouhei Sutou <kou****@clear*****> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -371,7 +372,7 @@ output_table_info(grn_ctx *ctx, grn_obj *table) grn_obj o; const char *path; grn_table_flags flags; - grn_obj *default_tokenizer; + grn_obj default_tokenizer; grn_obj *normalizer; grn_obj *token_filters; @@ -387,14 +388,24 @@ output_table_info(grn_ctx *ctx, grn_obj *table) grn_table_get_info(ctx, table, &flags, NULL, - &default_tokenizer, + NULL, &normalizer, &token_filters); + grn_dump_table_create_flags(ctx, flags, &o); grn_ctx_output_obj(ctx, &o, NULL); grn_proc_output_object_id_name(ctx, table->header.domain); grn_proc_output_object_id_name(ctx, grn_obj_get_range(ctx, table)); - grn_proc_output_object_name(ctx, default_tokenizer); + + GRN_TEXT_INIT(&default_tokenizer, 0); + grn_table_get_default_tokenizer_string(ctx, table, &default_tokenizer); + if (GRN_TEXT_LEN(&default_tokenizer) == 0) { + grn_ctx_output_null(ctx); + } else { + grn_ctx_output_obj(ctx, &default_tokenizer, NULL); + } + GRN_OBJ_FIN(ctx, &default_tokenizer); + grn_proc_output_object_name(ctx, normalizer); grn_ctx_output_array_close(ctx); GRN_OBJ_FIN(ctx, &o); Added: test/command/suite/table_list/default_tokenizer/option.expected (+56 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_list/default_tokenizer/option.expected 2018-10-25 20:52:32 +0900 (ded8727c1) @@ -0,0 +1,56 @@ +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer 'TokenNgram("n", 3)' +[[0,0.0,0.0],true] +table_list +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "id", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "path", + "ShortText" + ], + [ + "flags", + "ShortText" + ], + [ + "domain", + "ShortText" + ], + [ + "range", + "ShortText" + ], + [ + "default_tokenizer", + "ShortText" + ], + [ + "normalizer", + "ShortText" + ] + ], + [ + 256, + "Terms", + "db/db.0000100", + "TABLE_PAT_KEY|PERSISTENT", + "ShortText", + null, + "TokenNgram(\"n\", 3)", + null + ] + ] +] Added: test/command/suite/table_list/default_tokenizer/option.test (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_list/default_tokenizer/option.test 2018-10-25 20:52:32 +0900 (4b5fdf795) @@ -0,0 +1,3 @@ +table_create Terms TABLE_PAT_KEY ShortText \ + --default_tokenizer 'TokenNgram("n", 3)' +table_list -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181025/ba90890f/attachment-0001.html>