lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Filter !!!
Date Tue, 07 Dec 2004 05:55:53 GMT

:  Hits hits = indexSearcher.search(searchQuery, filter)   //  here I want
: to pass multiple filter...  (DateFilter,QueryFilter)

You can write a Filter that takes in multiple filters and ANDs them
together (or ORs them, it's not clear what you want)

   Hits h = s.search(q,new AndFilter(df,qf));

...

class AndFilter {
   final Filter a;
   final Filter b;
   public AndFilter(Filter a, Filter b) {
     this.a = a;
     this.b = b;
   }
   BitSet bits(IndexReader r) {
     return b.bits(r).and(a.bits(r));
   }
}


(I'm planing on writting a generalized "BooleanFilter" class sometime
in the next few weeks)

-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message