You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Hari Iyer <iy...@hotmail.com> on 2021/06/10 16:05:58 UTC

Facet domain change filter capabilities

Hi,
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”: {
   “blockChildren”:”type:Order”,
   “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?
Thanks,
Hari.