Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@apache.org Received: (qmail 32775 invoked from network); 28 Mar 2002 06:54:18 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 28 Mar 2002 06:54:18 -0000 Received: (qmail 25372 invoked by uid 97); 28 Mar 2002 06:54:28 -0000 Delivered-To: qmlist-jakarta-archive-lucene-user@jakarta.apache.org Received: (qmail 25340 invoked by uid 97); 28 Mar 2002 06:54:27 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 25329 invoked from network); 28 Mar 2002 06:54:26 -0000 Message-ID: <1A336BFB8DCA0840B29CC55F23EBB4A588F1CE@knk7.ww010.siemens.net> From: "Strittmatter Stephan (external)" To: "'Lucene Users List'" Subject: RE: Chainable Filter contribution Date: Thu, 28 Mar 2002 07:54:15 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Kelvin, I done som similar only doing XOR for my chains. But now your improved filter is better than my own. I think I will replace my own by yours. Will it be part of Lucene in future? Regards, Stephan > -----Original Message----- > From: Kelvin Tan [mailto:kelvin@relevanz.com] > Sent: Thursday, March 28, 2002 2:58 AM > To: Armbrust, Daniel C. > Cc: lucene-user@jakarta.apache.org > Subject: Re: Chainable Filter contribution > > > Dan, > > Totally my bad. I had since changed it but hadn't posted it > to the list coz > I didn't think anyone found it useful. > > Here's the correct version. I haven't really documented since > it's pretty > straightforward. Just holler if you need any help. > > Regards, > Kelvin > ----- Original Message ----- > From: "Armbrust, Daniel C." > To: > Sent: Thursday, March 28, 2002 5:17 AM > Subject: Chainable Filter contribution > > > > I found this in the mailing list, and I do need something > like this, as I > > need to apply more than one filter at a time. I'm fairly > new to lucene, > > however, and my knowledge of BitSets is very limited. > > > > My question, if you would be so kind as to donate a minute > of time to me, > is > > how does this combine the filters? From my nieve look > through it, it > seems > > that all filter results would get discarded except for the > last filter > that > > was applied. > > > > > > Thanks, > > > > Dan > > > > > > > > import org.apache.lucene.index.IndexReader; > > import org.apache.lucene.search.Filter; > > > > import java.io.IOException; > > import java.util.BitSet; > > > > /** > > *

> > * A ChainableFilter allows multiple filters to be chained > > * such that the result is the intersection of all the > > * filters. > > *

> > *

> > * Order in which filters are called depends on > > * the position of the filter in the chain. It's probably > > * more efficient to place the most restrictive filters > > * /least computationally-intensive filters first. > > *

> > * > > * @author Kelvin Tan > > */ > > public class ChainableFilter extends Filter > > { > > /** The filter chain */ > > private Filter[] chain = null; > > > > /** > > * Creates a new ChainableFilter. > > * > > * @param chain The chain of filters. > > */ > > public ChainableFilter(Filter[] chain) > > { > > this.chain = chain; > > } > > > > public BitSet bits(IndexReader reader) throws IOException > > { > > BitSet result = null; > > for (int i = 0; i < chain.length; i++) > > { > > result = chain[i].bits(reader); > > } > > return result; > > } > > } > > > > > -- To unsubscribe, e-mail: For additional commands, e-mail: