/*
* call-seq:
* term_doc_enum.seek(field, term) -> self
*
* Seek the term +term+ in the index for +field+. After you call this method
* you can call next or each to skip through the documents and positions of
* this particular term.
*/
static VALUE
frt_tde_seek(VALUE self, VALUE rfield, VALUE rterm)
{
TermDocEnum *tde = (TermDocEnum *)DATA_PTR(self);
char *term;
VALUE rfnum_map = rb_ivar_get(self, id_fld_num_map);
VALUE rfnum = rb_hash_aref(rfnum_map, rfield);
int field_num = -1;
term = StringValuePtr(rterm);
if (rfnum != Qnil) {
field_num = FIX2INT(rfnum);
} else {
rb_raise(rb_eArgError, "field %s doesn't exist in the index",
frt_field(rfield));
}
tde->seek(tde, field_num, term);
return self;
}