You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Timo Nentwig <lu...@nitwit.de> on 2008/11/08 19:06:15 UTC

How to combine filter in Lucene 2.4?

Hi!

Since Filter.bits() is deprecated and replaced by getDocIdSet() now I wonder 
how I am supposed to combine (AND) filters (for facets).

I worked around this issue by extending Filter and let getDocIdSet() return an 
OpenBitSet to ensure that this implementation is used everywhere and casting 
to OpenBitSet will work but this is really not clean code.

Thanks
Timo

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


Re: How to combine filter in Lucene 2.4?

Posted by Paul Elschot <pa...@xs4all.nl>.
Op Sunday 09 November 2008 11:56:37 schreef markharw00d:
>  >>this can't be nearly as fast as OpenBitSet.intersect() or union,
>
> respectively, can it?
>
> I had a similar concern but it doesn't seem that bad:
>
>
> https://issues.apache.org/jira/browse/LUCENE-1187?focusedCommentId=12
>596546#action_12596546
>
> The above test showed a slight improvement using bitset.or when it
> was recognised both docidsets were OpenBitSets. This optimisation is
> now in BooleanFilter.

Further to that, the current implementation of 
OpenBitSetDISI.inPlaceAnd() is not optimal, although it
should work just fine. A patch for a performance
improvement will follow.

Regards,
Paul Elschot


>
> Cheers
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



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


Re: How to combine filter in Lucene 2.4?

Posted by markharw00d <ma...@yahoo.co.uk>.
 >>this can't be nearly as fast as OpenBitSet.intersect() or union, 
respectively, can it?

I had a similar concern but it doesn't seem that bad:

   
https://issues.apache.org/jira/browse/LUCENE-1187?focusedCommentId=12596546#action_12596546

The above test showed a slight improvement using bitset.or when it was 
recognised both docidsets were OpenBitSets. This optimisation is now in 
BooleanFilter.

Cheers
Mark


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


Re: How to combine filter in Lucene 2.4?

Posted by Timo Nentwig <lu...@nitwit.de>.
On Saturday 08 November 2008 22:12:12 Paul Elschot wrote:
> Timo,
>
> You may be looking for class OpenBitSetDisi in the util package,
> it was made for boolean filter operations on OpenBitSets.
> Also have a look at the contrib modules, OpenBitSetDisi is

Okay, this is the third solution that is actually it's the only solution
when looking at the interface: iterate over both BitSets/Filters and compare 
doc-by-doc. I didn't take this into account, because this can't be nearly as 
fast as OpenBitSet.intersect() or union, respectively, can it?

> used there in two classes that do (precisely?) what you need:
> contrib/miscellaneous/**/ChainedFilter
> contrib/queries/**/BooleanFilter
>
> Regards,
> Paul Elschot
>
> Op Saturday 08 November 2008 19:06:15 schreef Timo Nentwig:
> > Hi!
> >
> > Since Filter.bits() is deprecated and replaced by getDocIdSet() now I
> > wonder how I am supposed to combine (AND) filters (for facets).
> >
> > I worked around this issue by extending Filter and let getDocIdSet()
> > return an OpenBitSet to ensure that this implementation is used
> > everywhere and casting to OpenBitSet will work but this is really not
> > clean code.
> >
> > Thanks
> > Timo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



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


Re: How to combine filter in Lucene 2.4?

Posted by Paul Elschot <pa...@xs4all.nl>.
Timo,

You may be looking for class OpenBitSetDisi in the util package,
it was made for boolean filter operations on OpenBitSets.
Also have a look at the contrib modules, OpenBitSetDisi is
used there in two classes that do (precisely?) what you need:
contrib/miscellaneous/**/ChainedFilter
contrib/queries/**/BooleanFilter

Regards,
Paul Elschot

Op Saturday 08 November 2008 19:06:15 schreef Timo Nentwig:
> Hi!
>
> Since Filter.bits() is deprecated and replaced by getDocIdSet() now I
> wonder how I am supposed to combine (AND) filters (for facets).
>
> I worked around this issue by extending Filter and let getDocIdSet()
> return an OpenBitSet to ensure that this implementation is used
> everywhere and casting to OpenBitSet will work but this is really not
> clean code.
>
> Thanks
> Timo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



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