lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Strittmatter Stephan (external)" <Stephan.Strittmatter....@kst.siemens.de>
Subject RE: Chainable Filter contribution
Date Thu, 28 Mar 2002 06:54:15 GMT
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." <Armbrust.Daniel@mayo.edu>
> To: <kelvin@relevanz.com>
> 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;
> >
> > /**
> >  * <p>
> >  * A ChainableFilter allows multiple filters to be chained
> >  * such that the result is the intersection of all the
> >  * filters.
> >  * </p>
> >  * <p>
> >  * 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.
> >  * </p>
> >  *
> >  * @author <a href="mailto:kelvin@relevanz.com">Kelvin Tan</a>
> >  */
> > 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:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message