lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Buso <>
Subject Re: Faceted search in OR
Date Thu, 24 Jan 2013 20:28:47 GMT
Hi Shai,

the use case is simple. Suppose you want to buy an hi-fi on a online
shop. Go in the website in the Electronic department and write "hi-fi"
in the search box, the interface return you lots of results and a facet
on brands (10 brands values).
You select brand A and the results are filtered accordingly; suppose now
you want to filter adding to the results the brand D, you can't because
the filtered results by A don't contain values D for the brand facet.

Than how can I retrieve also the facets for the results not filtered?
I think it's a common use case when you permit to the user to filter in
OR by facets.


On Thu, 2013-01-24 at 19:36 +0200, Shai Erera wrote:
> Hi Nicola,
> Regarding the OR drill-down, yes you can construct your own
> BooleanQuery, passing Occur.SHOULD instead of MUST. Currently
> DrillDown does not help you do that, so you can copy the code from
> DrillDown.query and change SHOULD to MUST. I opened LUCENE-4716 to add
> this support to DrillDown.
> Not sure that I understand your second question. If you want to
> retrieve counts for all descendants of A, then set your
> FR.setNumResults to Integer.MAX_VALUE. But note, it's going to be
> costly, i.e. you'd get a FacetResultNode per child of A, so depending
> how "wide" A is, this may have some impact on RAM consumption.
> If that's not what you meant, could you please clarify?
> Shai
> On Thu, Jan 24, 2013 at 7:22 PM, Nicola Buso <> wrote:
>         Hi all,
>         I'm introducing Lucene faceted search in our project and I
>         need some
>         hints to achieve some functionalities:
>         - I want facet filtering in OR, how to?
>           - obtain facets for the filtered results but also for the
>         non filtered
>         one. i.e. I have facet A with values A/V1, A/V2, A/V3 and
>         these values
>         are disjunct each other, than a document having field with
>         value V1
>         can't have also value V2 and so on; I would like to let the
>         user select
>         more of these facet values in OR; how can I accumulate all the
>         facets
>         values also filtering by facet selection? Should it work in a
>         way
>         similar to ComplementCountingAggregator?
>           - Can I use DrillDown class to obtain the OR facet filtering
>         or have I
>         to rewrite a similar class using the BooleanQuery in OR. It's
>         not clear
>         to me by this comment in the API:
>         Wraps a given Query as a drill-down query over the given
>         categories,
>         assuming all are required (e.g. AND). You can construct a
>         query with
>         different modes (such as OR or AND of ORs) by creating a
>         BooleanQuery
>         and call this method several times. Make sure to wrap the
>         query in that
>         case by ConstantScoreQuery and set the boost to 0.0f, so that
>         it doesn't
>         affect scoring.
>         Do you have any examples doing this?
>         Regards
>         Nicola.
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail:
>         For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message