Reputation: 2149
The question is applied for the following nested documents:
<doc>
<field name="id">1</field>
<field name="title">Solr has block join support</field>
<field name="content_type">parentDocument</field>
<doc>
<field name="id">11</field>
<field name="type">comment</field>
<field name="comments">SolrCloud supports it too!</field>
</doc>
<doc>
<field name="id">12</field>
<field name="type">publisher</field>
<field name="address">England</field>
....
</doc>
</doc>
....
My question is, how to write the Block Join Parent Query which allows to have constraints on multiple nested children documents? I did try the following, but it did not work:
{!parent which="content_type:accommodation"}
(
(+type:comment +comments:SolrCloud) AND
(+type:publisher +address:England)
)
0 was returned as result!
Upvotes: 3
Views: 3626
Reputation: 22386
For your use case you can just multiple block join filters:
q=*:*&
fq={!parent which="content_type:accommodation"}(+type:comment +comments:SolrCloud)&
fq={!parent which="content_type:accommodation"}(+type:publisher +address:England)
the first filter clouse will find which parent documents have a child which satisfies condition (+type:comment +comments:SolrCloud)
.
The second filter clouse will operate over subset of parent documents that satisfy the first filter. And it will find in this subset the parent documents that satisfy condition (+type:publisher +address:England)
.
Upvotes: 9