Kouhei Sutou
null+****@clear*****
Sun Jun 8 17:25:51 JST 2014
Kouhei Sutou 2014-06-08 17:25:51 +0900 (Sun, 08 Jun 2014) New Revision: 12a6b93806d053e3133e5e793c309d4b1d12f230 https://github.com/groonga/groonga/commit/12a6b93806d053e3133e5e793c309d4b1d12f230 Message: mrb: move type check code to mruby Modified files: lib/mrb/mrb_expr.c lib/mrb/scripts/scan_info.rb Modified: lib/mrb/mrb_expr.c (+4 -8) =================================================================== --- lib/mrb/mrb_expr.c 2014-06-08 15:10:49 +0900 (0531f2d) +++ lib/mrb/mrb_expr.c 2014-06-08 17:25:51 +0900 (0e03760) @@ -356,16 +356,12 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n, int k; grn_obj *arg, **p = &arg; for (k = 0; (arg = grn_scan_info_get_arg(ctx, si, k)) ; k++) { - if (GRN_DB_OBJP(*p)) { - mrb_value mrb_target; - mrb_target = grn_mrb_value_from_grn_obj(mrb, *p); - mrb_funcall(mrb, mrb_si, "resolve_index_db_obj", 1, mrb_target); - } else if (GRN_ACCESSORP(*p)) { + if ((*p)->header.type == GRN_BULK) { + mrb_funcall(mrb, mrb_si, "query=", 1, mrb_cptr_value(mrb, *p)); + } else { mrb_value mrb_target; mrb_target = grn_mrb_value_from_grn_obj(mrb, *p); - mrb_funcall(mrb, mrb_si, "resolve_index_accessor", 1, mrb_target); - } else { - mrb_funcall(mrb, mrb_si, "query=", 1, mrb_cptr_value(mrb, *p)); + mrb_funcall(mrb, mrb_si, "resolve_index", 1, mrb_target); } } } Modified: lib/mrb/scripts/scan_info.rb (+9 -0) =================================================================== --- lib/mrb/scripts/scan_info.rb 2014-06-08 15:10:49 +0900 (5b2b198) +++ lib/mrb/scripts/scan_info.rb 2014-06-08 17:25:51 +0900 (d54bbfa) @@ -7,6 +7,15 @@ module Groonga PRE_CONST = 0x08 end + def resolve_index(object) + if object.is_a?(Accessor) + resolve_index_accessor(object) + else + resolve_index_db_obj(object) + end + end + + private def resolve_index_db_obj(db_obj) index_info = db_obj.find_index(op) return if index_info.nil? -------------- next part -------------- HTML����������������������������... Download