Kouhei Sutou
null+****@clear*****
Tue Jan 28 22:56:14 JST 2014
Kouhei Sutou 2014-01-28 22:56:14 +0900 (Tue, 28 Jan 2014) New Revision: db8d2a194ef7f2b19f5d3ab3499260b1832939df https://github.com/groonga/groonga/commit/db8d2a194ef7f2b19f5d3ab3499260b1832939df Message: normalizer: support checks TODO: Document it. Modified files: lib/proc.c test/command/suite/normalize/ascii.expected test/command/suite/normalize/remove_blank.expected test/command/suite/normalize/remove_tokenized_delimiter.expected test/command/suite/normalize/with_types.expected Modified: lib/proc.c (+18 -1) =================================================================== --- lib/proc.c 2014-01-28 12:32:44 +0900 (c6f3e9f) +++ lib/proc.c 2014-01-28 22:56:14 +0900 (c677f69) @@ -2867,6 +2867,7 @@ proc_normalize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data grn_obj *normalizer; grn_obj *grn_string; int flags; + unsigned int normalized_length_in_bytes; unsigned int normalized_n_characters; flags = parse_normalize_flags(ctx, flag_names); @@ -2890,7 +2891,6 @@ proc_normalize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data GRN_OUTPUT_MAP_OPEN("RESULT", 2); { const char *normalized; - unsigned int normalized_length_in_bytes; grn_string_get_normalized(ctx, grn_string, &normalized, @@ -2916,6 +2916,23 @@ proc_normalize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data GRN_OUTPUT_ARRAY_CLOSE(); } } + { + const short *checks; + + checks = grn_string_get_checks(ctx, grn_string); + GRN_OUTPUT_CSTR("checks"); + if (checks) { + unsigned int i; + GRN_OUTPUT_ARRAY_OPEN("checks", normalized_length_in_bytes); + for (i = 0; i < normalized_length_in_bytes; i++) { + GRN_OUTPUT_INT32(checks[i]); + } + GRN_OUTPUT_ARRAY_CLOSE(); + } else { + GRN_OUTPUT_ARRAY_OPEN("checks", 0); + GRN_OUTPUT_ARRAY_CLOSE(); + } + } GRN_OUTPUT_MAP_CLOSE(); grn_obj_unlink(ctx, grn_string); Modified: test/command/suite/normalize/ascii.expected (+1 -1) =================================================================== --- test/command/suite/normalize/ascii.expected 2014-01-28 12:32:44 +0900 (8ac1422) +++ test/command/suite/normalize/ascii.expected 2014-01-28 22:56:14 +0900 (a3647e0) @@ -1,2 +1,2 @@ normalize NormalizerAuto "aBcDe 123" -[[0,0.0,0.0],{"normalized":"abcde 123","types":[]}] +[[0,0.0,0.0],{"normalized":"abcde 123","types":[],"checks":[]}] Modified: test/command/suite/normalize/remove_blank.expected (+1 -1) =================================================================== --- test/command/suite/normalize/remove_blank.expected 2014-01-28 12:32:44 +0900 (7937d1e) +++ test/command/suite/normalize/remove_blank.expected 2014-01-28 22:56:14 +0900 (09a1cca) @@ -1,2 +1,2 @@ normalize NormalizerAuto "a b c" REMOVE_BLANK -[[0,0.0,0.0],{"normalized":"abc","types":[]}] +[[0,0.0,0.0],{"normalized":"abc","types":[],"checks":[]}] Modified: test/command/suite/normalize/remove_tokenized_delimiter.expected (+1 -1) =================================================================== --- test/command/suite/normalize/remove_tokenized_delimiter.expected 2014-01-28 12:32:44 +0900 (8c18cf6) +++ test/command/suite/normalize/remove_tokenized_delimiter.expected 2014-01-28 22:56:14 +0900 (4a39e27) @@ -1,2 +1,2 @@ normalize NormalizerAuto "abc" REMOVE_TOKENIZED_DELIMITER -[[0,0.0,0.0],{"normalized":"abc","types":[]}] +[[0,0.0,0.0],{"normalized":"abc","types":[],"checks":[]}] Modified: test/command/suite/normalize/with_types.expected (+3 -0) =================================================================== --- test/command/suite/normalize/with_types.expected 2014-01-28 12:32:44 +0900 (e6e4be8) +++ test/command/suite/normalize/with_types.expected 2014-01-28 22:56:14 +0900 (3cafc5a) @@ -16,6 +16,9 @@ normalize NormalizerAuto "a1!あア亜💕 " WITH_TYPES "kanji", "others", "others" + ], + "checks": [ + ] } ] -------------- next part -------------- HTML����������������������������...Download