Kouhei Sutou
null+****@clear*****
Thu Feb 4 11:54:50 JST 2016
Kouhei Sutou 2016-02-04 11:54:50 +0900 (Thu, 04 Feb 2016) New Revision: ed8fd6f99c17a3a0dba85c9a24d22dcfd5193c4f https://github.com/groonga/groonga/commit/ed8fd6f99c17a3a0dba85c9a24d22dcfd5193c4f Message: Group fuzzy related parameters Modified files: include/groonga/groonga.h lib/db.c lib/grn_ii.h lib/ii.c Modified: include/groonga/groonga.h (+5 -3) =================================================================== --- include/groonga/groonga.h 2016-02-04 11:44:32 +0900 (b796130) +++ include/groonga/groonga.h 2016-02-04 11:54:50 +0900 (323d25f) @@ -948,9 +948,11 @@ struct _grn_search_optarg { grn_obj *scorer; grn_obj *scorer_args_expr; unsigned int scorer_args_expr_offset; - unsigned int fuzzy_prefix_match_size; - unsigned int fuzzy_max_distance; - int fuzzy_flags; + struct { + unsigned int prefix_match_size; + unsigned int max_distance; + int flags; + } fuzzy; }; GRN_API grn_rc grn_obj_search(grn_ctx *ctx, grn_obj *obj, grn_obj *query, Modified: lib/db.c (+4 -3) =================================================================== --- lib/db.c 2016-02-04 11:44:32 +0900 (d8ea576) +++ lib/db.c 2016-02-04 11:54:50 +0900 (d305874) @@ -3466,9 +3466,10 @@ grn_obj_search(grn_ctx *ctx, grn_obj *obj, grn_obj *query, } if (optarg && optarg->mode == GRN_OP_FUZZY) { rc = grn_table_fuzzy_search(ctx, obj, key, key_size, - optarg->fuzzy_prefix_match_size, - optarg->fuzzy_max_distance, - optarg->fuzzy_flags, res); + optarg->fuzzy.prefix_match_size, + optarg->fuzzy.max_distance, + optarg->fuzzy.flags, + res); } else { rc = grn_table_search(ctx, obj, key, key_size, mode, res, op); } Modified: lib/grn_ii.h (+5 -3) =================================================================== --- lib/grn_ii.h 2016-02-04 11:44:32 +0900 (5ca7bab) +++ lib/grn_ii.h 2016-02-04 11:54:50 +0900 (6c2ff06) @@ -143,9 +143,11 @@ struct _grn_select_optarg { grn_obj *scorer; grn_obj *scorer_args_expr; unsigned int scorer_args_expr_offset; - unsigned int fuzzy_prefix_match_size; - unsigned int fuzzy_max_distance; - int fuzzy_flags; + struct { + unsigned int prefix_match_size; + unsigned int max_distance; + int flags; + } fuzzy; }; GRN_API grn_rc grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id id, Modified: lib/ii.c (+20 -17) =================================================================== --- lib/ii.c 2016-02-04 11:44:32 +0900 (6d92d1e) +++ lib/ii.c 2016-02-04 11:54:50 +0900 (c17d4a7) @@ -5461,9 +5461,11 @@ typedef struct { } token_info; typedef struct { - unsigned int fuzzy_prefix_match_size; - unsigned int fuzzy_max_distance; - int fuzzy_flags; + struct { + unsigned int prefix_match_size; + unsigned int max_distance; + int flags; + } fuzzy; } token_info_optarg; #define EX_NONE 0 @@ -5600,9 +5602,10 @@ token_info_open(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, case EX_FUZZY : if ((h = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, 0))) { grn_table_fuzzy_search(ctx, lexicon, key, key_size, - arg->fuzzy_prefix_match_size, - arg->fuzzy_max_distance, - arg->fuzzy_flags, (grn_obj *)h); + arg->fuzzy.prefix_match_size, + arg->fuzzy.max_distance, + arg->fuzzy.flags, + (grn_obj *)h); if (GRN_HASH_SIZE(h)) { if ((ti->cursors = cursor_heap_open(ctx, GRN_HASH_SIZE(h)))) { GRN_HASH_EACH(ctx, h, id, &tp, NULL, NULL, { @@ -6550,7 +6553,7 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, grn_obj *lexicon = ii->lexicon; grn_scorer_score_func *score_func = NULL; grn_scorer_matched_record record; - token_info_optarg token_info_arg = {0, 0, 0}; + token_info_optarg token_info_arg = {0}; if (!lexicon || !ii || !s) { return GRN_INVALID_ARGUMENT; } if (optarg) { @@ -6561,9 +6564,9 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, wvm = optarg->weight_vector ? grn_wv_static : grn_wv_constant; } if (mode == GRN_OP_FUZZY) { - token_info_arg.fuzzy_prefix_match_size = optarg->fuzzy_prefix_match_size; - token_info_arg.fuzzy_max_distance = optarg->fuzzy_max_distance; - token_info_arg.fuzzy_flags = optarg->fuzzy_flags; + token_info_arg.fuzzy.prefix_match_size = optarg->fuzzy.prefix_match_size; + token_info_arg.fuzzy.max_distance = optarg->fuzzy.max_distance; + token_info_arg.fuzzy.flags = optarg->fuzzy.flags; } } if (mode == GRN_OP_SIMILAR) { @@ -6860,7 +6863,7 @@ grn_ii_estimate_size_for_query(grn_ctx *ctx, grn_ii *ii, grn_operator mode = GRN_OP_EXACT; double estimated_size = 0; double normalized_ratio = 1.0; - token_info_optarg token_info_arg = {0, 0, 0}; + token_info_optarg token_info_arg = {0}; if (query_len == 0) { return 0; @@ -6880,9 +6883,9 @@ grn_ii_estimate_size_for_query(grn_ctx *ctx, grn_ii *ii, break; case GRN_OP_FUZZY : mode = optarg->mode; - token_info_arg.fuzzy_prefix_match_size = optarg->fuzzy_prefix_match_size; - token_info_arg.fuzzy_max_distance = optarg->fuzzy_max_distance; - token_info_arg.fuzzy_flags = optarg->fuzzy_flags; + token_info_arg.fuzzy.prefix_match_size = optarg->fuzzy.prefix_match_size; + token_info_arg.fuzzy.max_distance = optarg->fuzzy.max_distance; + token_info_arg.fuzzy.flags = optarg->fuzzy.flags; default : break; } @@ -6987,9 +6990,9 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len break; case GRN_OP_FUZZY : arg.mode = optarg->mode; - arg.fuzzy_prefix_match_size = optarg->fuzzy_prefix_match_size; - arg.fuzzy_max_distance = optarg->fuzzy_max_distance; - arg.fuzzy_flags = optarg->fuzzy_flags; + arg.fuzzy.prefix_match_size = optarg->fuzzy.prefix_match_size; + arg.fuzzy.max_distance = optarg->fuzzy.max_distance; + arg.fuzzy.flags = optarg->fuzzy.flags; break; default : break; -------------- next part -------------- HTML����������������������������... Download