Class: Ferret::Search::Filter
Summary
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.
Public Instance Methods
filter.bits(index_reader) → bit_vector
Get the bit_vector used by this filter. This method will usually be used to group filters or apply filters to other filters.
/*
* call-seq:
* filter.bits(index_reader) -> bit_vector
*
* 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
frt_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 frt_get_bv(bv);
}
filter.to_s → string
Return a human readable string representing the Filter object that the method was called on.
/*
* call-seq:
* filter.to_s -> string
*
* Return a human readable string representing the Filter object that the
* method was called on.
*/
static VALUE
frt_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;
}