A Filter is used to filter query results. It is usually passed to one of Searcher's search methods however it can also be used inside a ConstantScoreQuery or a FilteredQuery. To implement your own Filter you must implement the method get_bitvector(index_reader) which returns a BitVector with set bits corresponding to documents that are allowed by this Filter.
TODO add support for user implemented Filter. TODO add example of user implemented Filter.
Get the bit_vector used by this filter. This method will usually be used to group filters or apply filters to other filters.
static VALUE
frb_f_get_bits(VALUE self, VALUE rindex_reader)
{
BitVector *bv;
IndexReader *ir;
GET_F();
Data_Get_Struct(rindex_reader, IndexReader, ir);
bv = filt_get_bv(f, ir);
return frb_get_bv(bv);
}
Return a human readable string representing the Filter object that the method was called on.
static VALUE
frb_f_to_s(VALUE self)
{
VALUE rstr;
char *str;
GET_F();
str = f->to_s(f);
rstr = rb_str_new2(str);
free(str);
return rstr;
}
Generated with the Darkfish Rdoc Generator 2.