Navigation Menu

Skip to content

Commit

Permalink
mrb: implement resolving index of data column in expr on match by mruby
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 9, 2014
1 parent 5c063fd commit 62f32f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/mrb/mrb_expr.c
Expand Up @@ -193,13 +193,15 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
break;
case GRN_COLUMN_FIX_SIZE :
case GRN_COLUMN_VAR_SIZE :
if (grn_column_index(ctx, ec->value, c->op, &index, 1, &sid)) {
mrb_value mrb_ec = mrb_grn_expr_code_new(mrb, ec);
weight = mrb_fixnum(mrb_funcall(mrb, mrb_ec, "weight", 0));
mrb_funcall(mrb, mrb_si, "put_index", 3,
grn_mrb_value_from_grn_obj(mrb, index),
mrb_fixnum_value(sid),
mrb_fixnum_value(weight));
{
mrb_value mrb_column;
mrb_value mrb_ec;

mrb_column = grn_mrb_value_from_grn_obj(mrb, ec->value);
mrb_ec = mrb_grn_expr_code_new(mrb, ec);
mrb_funcall(mrb, mrb_si,
"match_expr_resolve_index_data_column",
2, mrb_column, mrb_ec);
}
break;
case GRN_COLUMN_INDEX :
Expand Down
6 changes: 6 additions & 0 deletions lib/mrb/scripts/scan_info.rb
Expand Up @@ -29,6 +29,12 @@ def match_expr_resolve_index_accessor(accessor, expr_code)
end
end

def match_expr_resolve_index_data_column(column, expr_code)
index_info = column.find_index(op)
return if index_info.nil?
put_index(index_info.index, index_info.section_id, expr_code.weight)
end

def match_resolve_index_db_obj(db_obj)
index_info = db_obj.find_index(op)
return if index_info.nil?
Expand Down

0 comments on commit 62f32f4

Please sign in to comment.