Facet domain change filter capabilities

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Facet domain change filter capabilities

Hari Iyer-2
Is it possible to filter the changed domain (child) documents using fields from the original domain (parent) when faceting?

Consider an example of Order documents which have OrderItem documents as children (block join/nested).
Order -> fields: customerId, orderdate, type
OrderItem -> fields: productid, quantity, unitprice, type
I want to retrieve orders and items (a contrived scenario) where orderdate > DATE OR quantity > 10 and facet by customerId and sum(unitprice). This is rather like a SQL group by than a typical solr facet.

I can retrieve order documents based on that filter and facet by customerId.
I can then change the facet domain to orderitems (blockChildren) but the filter is not just based on orderitem documents. I need to get all orderitems if the (original domain) orderdate > DATE else get orderitems with quantity > 10.

“domain”: {
   “filter”:”type:OrderItem AND (orderdate:[DATE TO *] OR quantity:[10 TO *])”

I am mixing parent and child document fields here without any qualification, and as expected the above doesn’t work (orderDate filter is always false). Is there support for this use-case at all?