cFilter
QueryFilter can be used to restrict one queries results by another queries results, basically "and"ing them together. Of course you could easily use a BooleanQuery to do this. The reason you may choose to use a QueryFilter is that Filter results are cached so if you have one query that is often added to other queries you may want to use a QueryFilter for performance reasons.
Let's say you have a field :approved which you set to yes when a document is approved for display. You'll probably want to add a Filter which filters approved documents to display to your users. This is the perfect use case for a QueryFilter.
filter = QueryFilter.new(TermQuery.new(:approved, "yes"))
Just remember to use the same QueryFilter each time to take advantage of caching. Don't create a new one for each request. Of course, this won't work in a CGI application.
Create a new QueryFilter which applies the query query.
static VALUE
frb_qf_init(VALUE self, VALUE rquery)
{
Query *q;
Filter *f;
Data_Get_Struct(rquery, Query, q);
f = qfilt_new(q);
Frt_Wrap_Struct(self, NULL, &frb_f_free, f);
object_add(f, self);
return self;
}
Generated with the Darkfish Rdoc Generator 2.