mrb: move index resolve code on match to mruby