/* * call-seq: * index_reader.term_count(field) -> int * * Same return a count of the number of terms in the field */ static VALUE frb_ir_term_count(VALUE self, VALUE rfield) { IndexReader *ir = (IndexReader *)DATA_PTR(self); TermEnum *te = ir_terms(ir, frb_field(rfield)); int count = 0; while (te->next(te)) { count++; } te->close(te); return INT2FIX(count); }