Mailing List Archive

Nested Facets
For an application that already has a Lucene Index, I would like to
implement a facet search that return result aggregations in two
dimensions. From the Lucene examples [1] I can see how to do a simple
facet search that collects facets in one dimension but I haven't seen
any examples for a two-step faceting.

Let's say I have a query X and two facet dimensions A and B on which I
would like to aggregate the hits. - How can I achieve the following
result (I am only interested in count of distinct pairs A|B):

X + A1 - B1 (12)
| B2 (3)
| B4 (8)
|
+ A2 - B1 (1)
| - B5 (8)
| - B9 (1)
| - B14 (15)
| - B15 (42)
| - B20 (95)
|
+ A3 - B2 (3)
| - B3 (1)
| - B4 (3)
| - B27 (7)
| - B31 (10)
| - B32 (21)
.
.
.
|
+ An - B4 (75)
- B9 (6)
- B15 (18)
- B41 (11)

For a naive solution I could perform a facet search on dim A, iterate
over A1..An and then, for each facet of A, perform another facet search
on dim B. But that is probably not efficient.

What is the recommended way to do this? I can see that Solr/ES provide
such a feature (sub-facet/nested aggregation) via their query language
but I would prefer to stick with a pure Lucene solution for now.

-Matthias

[1]
https://lucene.apache.org/core/7_7_2/demo/org/apache/lucene/demo/facet/package-summary.html


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Nested Facets [ In reply to ]
You should be looking at Facet pivots feature what Solr provides based on
doc-values.

As you are using core Lucene you may have to do little more search on how
to do at low level with Lucene Facet API based on DocValues facet.

Your starting point should be
https://lucene.apache.org/core/8_2_0/facet/index.html


On Thu, Aug 29, 2019 at 3:11 PM Matthias Müller <
matthias_mueller@tu-dresden.de> wrote:

> For an application that already has a Lucene Index, I would like to
> implement a facet search that return result aggregations in two
> dimensions. From the Lucene examples [1] I can see how to do a simple
> facet search that collects facets in one dimension but I haven't seen
> any examples for a two-step faceting.
>
> Let's say I have a query X and two facet dimensions A and B on which I
> would like to aggregate the hits. - How can I achieve the following
> result (I am only interested in count of distinct pairs A|B):
>
> X + A1 - B1 (12)
> | B2 (3)
> | B4 (8)
> |
> + A2 - B1 (1)
> | - B5 (8)
> | - B9 (1)
> | - B14 (15)
> | - B15 (42)
> | - B20 (95)
> |
> + A3 - B2 (3)
> | - B3 (1)
> | - B4 (3)
> | - B27 (7)
> | - B31 (10)
> | - B32 (21)
> .
> .
> .
> |
> + An - B4 (75)
> - B9 (6)
> - B15 (18)
> - B41 (11)
>
> For a naive solution I could perform a facet search on dim A, iterate
> over A1..An and then, for each facet of A, perform another facet search
> on dim B. But that is probably not efficient.
>
> What is the recommended way to do this? I can see that Solr/ES provide
> such a feature (sub-facet/nested aggregation) via their query language
> but I would prefer to stick with a pure Lucene solution for now.
>
> -Matthias
>
> [1]
>
> https://lucene.apache.org/core/7_7_2/demo/org/apache/lucene/demo/facet/package-summary.html
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>