Can't you just have two clauses in the query, one that does join and one
that does the same search again but with additional rule of not having a
parentID? Then nested documents match first clause and get "joined" into
the parent record. And non nested documents would match by themselves. I
think you could even use local parameter variables to avoid repeating the
common query.

Regards,
   Alex

On 26 Sep 2016 3:59 AM, "shamik" <sham...@gmail.com> wrote:

> Thanks Alex. With the conventional join query I'm able to return the parent
> document based on a query match on the child. But, it filters out any other
> documents which are outside the scope of join condition. For e.g. in my
> case, I would expect the query to return :
>
> <doc>
>    <field name="id">1</field>
>    <field name="title">Parent title</field>
>    <field name="doc_id">123</field>
> </doc>
> <doc>
>    <field name="id">4</field>
>    <field name="title">Misc title2</field>
> </doc>
>
> I'm only getting back id=1 with the following join query :
>
> *{!join from=parent_doc_id to=doc_id}title2*
>
> Is there a way to get the document with id=4 ?
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/How-to-retrieve-parent-documents-without-a-
> nested-structure-block-join-tp4297510p4297935.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to