lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <>
Subject Re: Multiple facets in Lucene searches
Date Wed, 21 Nov 2012 19:52:02 GMT
Hi Jan,

Basically, DrillDown is a helper class for creating such queries. You're
right that its query() methods create AND, because that's normally the
case, but if you require OR, you could do this:

    BooleanQuery res = new BooleanQuery();
    for (CategoryPath cp : paths) {
      res.add(new TermQuery(DrillDown.term(iParams, cp)), Occur.SHOULD);

I copied the code from DrillDown.query(FacetIndexingParams,
CategoryPath...) and modified Occur.MUST to Occur.SHOULD.

Can you give it a try?


On Wed, Nov 21, 2012 at 7:27 PM, Jan Stette <> wrote:

> Hi,
> I'm trying to use Lucene Facet for doing faceted searches. I've hit a
> problem with a use case where users in my application needs to be able to
> select multiple facets then run a search for things that match either of
> the facets.
> Using DrillDown.query(), it treats multiple facets using AND, so that it
> returns hits that match all of the given facets, as described here:
> .
> That's good for some use cases, but not for all. Is there a way to specify
> OR instead of AND for drilldown queries. Alternatively, a way to achieve
> the same result using another type of query?
> Regards,
> Jan

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message