Naoya Murakami
null+****@clear*****
Wed Dec 28 20:21:24 JST 2016
Naoya Murakami 2016-12-28 20:21:24 +0900 (Wed, 28 Dec 2016) New Revision: 2e09d3aea15d93f27b4df73e7aebfff502b3dfc4 https://github.com/groonga/groonga/commit/2e09d3aea15d93f27b4df73e7aebfff502b3dfc4 Merged d631047: Merge pull request #620 from naoa/reset-min-for-escalation Message: Reset match_info->min when escalation Modified files: lib/ii.c Modified: lib/ii.c (+27 -0) =================================================================== --- lib/ii.c 2016-12-28 18:50:57 +0900 (82da095) +++ lib/ii.c 2016-12-28 20:21:24 +0900 (e3c1710) @@ -8281,23 +8281,50 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len } GRN_LOG(ctx, GRN_LOG_INFO, "exact: %d", GRN_HASH_SIZE(s)); if (op == GRN_OP_OR) { + grn_id min = GRN_ID_NIL; if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold) { arg.mode = GRN_OP_UNSPLIT; + if (arg.match_info) { + if (arg.match_info->flags & GRN_MATCH_INFO_GET_MIN_RECORD_ID) { + min = arg.match_info->min; + arg.match_info->min = GRN_ID_NIL; + } + } if (grn_ii_select(ctx, ii, string, string_len, s, op, &arg)) { GRN_LOG(ctx, GRN_LOG_ERROR, "grn_ii_select on grn_ii_sel(2) failed !"); return ctx->rc; } GRN_LOG(ctx, GRN_LOG_INFO, "unsplit: %d", GRN_HASH_SIZE(s)); + if (arg.match_info) { + if (arg.match_info->flags & GRN_MATCH_INFO_GET_MIN_RECORD_ID) { + if (min > GRN_ID_NIL && min < arg.match_info->min) { + arg.match_info->min = min; + } + } + } } if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold) { arg.mode = GRN_OP_PARTIAL; + if (arg.match_info) { + if (arg.match_info->flags & GRN_MATCH_INFO_GET_MIN_RECORD_ID) { + min = arg.match_info->min; + arg.match_info->min = GRN_ID_NIL; + } + } if (grn_ii_select(ctx, ii, string, string_len, s, op, &arg)) { GRN_LOG(ctx, GRN_LOG_ERROR, "grn_ii_select on grn_ii_sel(3) failed !"); return ctx->rc; } GRN_LOG(ctx, GRN_LOG_INFO, "partial: %d", GRN_HASH_SIZE(s)); + if (arg.match_info) { + if (arg.match_info->flags & GRN_MATCH_INFO_GET_MIN_RECORD_ID) { + if (min > GRN_ID_NIL && min < arg.match_info->min) { + arg.match_info->min = min; + } + } + } } } GRN_LOG(ctx, GRN_LOG_INFO, "hits=%d", GRN_HASH_SIZE(s)); -------------- next part -------------- HTML����������������������������... Download