Kouhei Sutou
null+****@clear*****
Tue Oct 20 11:44:19 JST 2015
Kouhei Sutou 2015-10-20 11:44:19 +0900 (Tue, 20 Oct 2015) New Revision: f24a31bd2f7c7c576b31a736e097f6534b1eade8 https://github.com/groonga/groonga/commit/f24a31bd2f7c7c576b31a736e097f6534b1eade8 Message: schema: use object style for extensibility Modified files: lib/proc.c test/command/suite/schema/tables/normalizer.expected test/command/suite/schema/tables/token_filters.expected test/command/suite/schema/tables/tokenizer.expected Modified: lib/proc.c (+22 -0) =================================================================== --- lib/proc.c 2015-10-20 11:41:45 +0900 (2561182) +++ lib/proc.c 2015-10-20 11:44:19 +0900 (e955bc8) @@ -7534,16 +7534,38 @@ static void proc_schema_table_output_tokenizer(grn_ctx *ctx, grn_obj *table) { grn_obj *tokenizer; + tokenizer = grn_obj_get_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, NULL); + if (!tokenizer) { + GRN_OUTPUT_NULL(); + return; + } + + GRN_OUTPUT_MAP_OPEN("tokenizer", 1); + + GRN_OUTPUT_CSTR("name"); proc_schema_output_name(ctx, tokenizer); + + GRN_OUTPUT_MAP_CLOSE(); } static void proc_schema_table_output_normalizer(grn_ctx *ctx, grn_obj *table) { grn_obj *normalizer; + normalizer = grn_obj_get_info(ctx, table, GRN_INFO_NORMALIZER, NULL); + if (!normalizer) { + GRN_OUTPUT_NULL(); + return; + } + + GRN_OUTPUT_MAP_OPEN("normalizer", 1); + + GRN_OUTPUT_CSTR("name"); proc_schema_output_name(ctx, normalizer); + + GRN_OUTPUT_MAP_CLOSE(); } static void Modified: test/command/suite/schema/tables/normalizer.expected (+3 -1) =================================================================== --- test/command/suite/schema/tables/normalizer.expected 2015-10-20 11:41:45 +0900 (feb2d86) +++ test/command/suite/schema/tables/normalizer.expected 2015-10-20 11:44:19 +0900 (9a0359b) @@ -176,7 +176,9 @@ schema }, "value_type": null, "tokenizer": null, - "normalizer": "NormalizerAuto", + "normalizer": { + "name": "NormalizerAuto" + }, "token_filters": [ ] Modified: test/command/suite/schema/tables/token_filters.expected (+3 -1) =================================================================== --- test/command/suite/schema/tables/token_filters.expected 2015-10-20 11:41:45 +0900 (7403bb3) +++ test/command/suite/schema/tables/token_filters.expected 2015-10-20 11:44:19 +0900 (ab6f24e) @@ -183,7 +183,9 @@ schema "type": "type" }, "value_type": null, - "tokenizer": "TokenBigram", + "tokenizer": { + "name": "TokenBigram" + }, "normalizer": null, "token_filters": [ { Modified: test/command/suite/schema/tables/tokenizer.expected (+3 -1) =================================================================== --- test/command/suite/schema/tables/tokenizer.expected 2015-10-20 11:41:45 +0900 (bf1b93b) +++ test/command/suite/schema/tables/tokenizer.expected 2015-10-20 11:44:19 +0900 (0140f9a) @@ -175,7 +175,9 @@ schema "type": "type" }, "value_type": null, - "tokenizer": "TokenBigram", + "tokenizer": { + "name": "TokenBigram" + }, "normalizer": null, "token_filters": [ -------------- next part -------------- HTML����������������������������...Download