Mailing List Archive

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;
> }
> }
>
>
RE: Chainable Filter contribution [ In reply to ]
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>
Re: Chainable Filter contribution [ In reply to ]
Stephan,

I honestly don't know. There's going to be a /contrib section set up soon
though, so I think it might go in there at least.

Does it matter? :)

Regards,
Kelvin
----- Original Message -----
From: "Strittmatter Stephan (external)"
<Stephan.Strittmatter.ext@kst.siemens.de>
To: "'Lucene Users List'" <lucene-user@jakarta.apache.org>
Sent: Thursday, March 28, 2002 2:54 PM
Subject: RE: Chainable Filter contribution


> 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>
>
>


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: Chainable Filter contribution [ In reply to ]
Kevin,

it does no matter, but would be nice.

Stephan

> -----Original Message-----
> From: Kelvin Tan [mailto:kelvin@relevanz.com]
> Sent: Thursday, March 28, 2002 8:15 AM
> To: Lucene Users List
> Subject: Re: Chainable Filter contribution
>
>
> Stephan,
>
> I honestly don't know. There's going to be a /contrib section
> set up soon
> though, so I think it might go in there at least.
>
> Does it matter? :)
>
> Regards,
> Kelvin
> ----- Original Message -----
> From: "Strittmatter Stephan (external)"
> <Stephan.Strittmatter.ext@kst.siemens.de>
> To: "'Lucene Users List'" <lucene-user@jakarta.apache.org>
> Sent: Thursday, March 28, 2002 2:54 PM
> Subject: RE: Chainable Filter contribution
>
>
> > 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>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: Chainable Filter contribution [ In reply to ]
Thanks. It makes much more sense now. For a while there I thought maybe
the BitSets were performing some black magic that I hadn't yet learned
about.

Dan






-----Original Message-----
From: Kelvin Tan [mailto:kelvin@relevanz.com]
Sent: Wednesday, March 27, 2002 7:58 PM
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


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