Navigation Menu

Skip to content

Commit

Permalink
schema: use object style for extensibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 20, 2015
1 parent 1149af3 commit f24a31b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
22 changes: 22 additions & 0 deletions lib/proc.c
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/command/suite/schema/tables/normalizer.expected
Expand Up @@ -176,7 +176,9 @@ schema
},
"value_type": null,
"tokenizer": null,
"normalizer": "NormalizerAuto",
"normalizer": {
"name": "NormalizerAuto"
},
"token_filters": [

]
Expand Down
4 changes: 3 additions & 1 deletion test/command/suite/schema/tables/token_filters.expected
Expand Up @@ -183,7 +183,9 @@ schema
"type": "type"
},
"value_type": null,
"tokenizer": "TokenBigram",
"tokenizer": {
"name": "TokenBigram"
},
"normalizer": null,
"token_filters": [
{
Expand Down
4 changes: 3 additions & 1 deletion test/command/suite/schema/tables/tokenizer.expected
Expand Up @@ -175,7 +175,9 @@ schema
"type": "type"
},
"value_type": null,
"tokenizer": "TokenBigram",
"tokenizer": {
"name": "TokenBigram"
},
"normalizer": null,
"token_filters": [

Expand Down

0 comments on commit f24a31b

Please sign in to comment.