child.facet.field  works if parent query goes as q ie q={!parent
which="doc_type:parent"}color:blue.
However, it's considered as deprecated and proposed to be replaced with
json.facet and uniqueBlock

On Wed, Jul 18, 2018 at 7:04 AM soham gandhi <sohamgandh...@gmail.com>
wrote:

> Hi,
>
> I am working on a query that must return parent docs and facet on both the
> parent and child fields. Here's a sample doc-
> <doc>
> <field name="id">1</field>
> <field name="name">merc</field>
> <field name="type">car</field>
> <field name="user">sagandhi</field>
> <field name="child_id">2</field>
> <field name="child_id">3</field>
> <field name="doc_type">parent</field>
> <doc>
> <field name="id">2</field>
> <field name="doc_type">child</field>
> <field name="class">S</field>
> <field name="color">blue</field>
> </doc>
> <doc>
> <field name="id">3</field>
> <field name="class">Z</field>
> <field name="code">25</field>
> <field name="doc_type">child</field>
> </doc>
> </doc>
> I want to search for "merc" or "*" and return facets for type/user from
> parent docs, and code/color from child docs. Currently I am not using
> blockjoin. Instead I make two queries, one on the parent docs and the other
> on the child docs. I get the applicable child_id from the first query and
> feed it into the second query to get the child facets.
> However this has impacted performance and is not scalable if the child_ids
> I get are huge. Is there a way to combine the two queries using block join.
> I tried this query -
> q=*:* &fq=user:sagandhi &fq={!parent
> which="doc_type:parent"}color:blue&facet.field=type&child.facet.field=code
>
> I get this error - Block join faceting is allowed with
> ToParentBlockJoinQuery only
>
> Am I missing something here? Any pointers please.
>
> Thanks,
> Soham
>


-- 
Sincerely yours
Mikhail Khludnev

Reply via email to