Hi Jan, The way I remember it was done (or at least we did it) is by storing the depth information as a field in the document using an update request processor and using a custom transformer to reconstruct the original multi-level document from it.
Also, this was a reasonably long time ago, so things might have changed since then. Anshum On Thu, Mar 24, 2016 at 12:53 PM Mikhail Khludnev < mkhlud...@griddynamics.com> wrote: > I think you cal already kick tires and contribute a test case into > https://issues.apache.org/jira/browse/SOLR-8208 that's already reachable > there I believe, but I still working on core design. > > On Thu, Mar 24, 2016 at 10:02 PM, Alisa Z. <prol...@mail.ru> wrote: > > > Hi all, > > > > I apologize for duplicating my previous message: > > Solr 5.3: anything similar to ChildDocTransformerFactory that does not > > flatten the hierarchical structure? > > > > However, it is still an open and interesting question: > > > > Following the example from https://dzone.com/articles/using-solr-49-new > > , let's say we are given multiple-level nested structure: > > > > <doc> > > <field name="id">1</field> > > <field name="name">I am the parent</field> > > <field name="cat">PARENT</field> > > <doc> > > <field name="id">1.1</field> > > <field name="name">I am the 1st child</field> > > <field name="cat">CHILD</field> > > </doc> > > <doc> > > <field name="id">1.2</field> > > <field name="name">I am the 2nd child</field> > > <field name="cat">CHILD</field> > > <doc> > > <field name="id">1.2.1</field> > > <field name="name">I am a grandchildren</field> > > <field name="cat">GRANDCHILD</field> > > </doc> > > </doc> > > </doc> > > > > > > Querying > > q={!parent which="cat:PARENT"}name:(I am +child)&fl=id,name,[child > > parentFilter=cat:PARENT] > > > > will return flattened structure, where cat:CHILD and cat:GRANDCHILD > > documents end up on the same level: > > <doc> > > <field name="id">1</field> > > <field name="name">I am the parent</field> > > <field name="cat">PARENT</field> > > <doc> > > <field name="id">1.1</field> > > <field name="name">I am the 1st child</field> > > <field name="cat">CHILD</field> > > </doc> > > <doc> > > <field name="id">1.2</field> > > <field name="name">I am the 2nd child</field> > > <field name="cat">CHILD</field> > > </doc> > > <doc> > > <field name="id">1.2.1</field> > > <field name="name">I am a grandchildren</field> > > <field name="cat">GRANDCHILD</field> > > </doc> > > </doc> Indeed, the JAVAdocs for ChildDocTransformerFactory say: "This > > transformer returns all descendants of each parent document in a flat > list > > nested inside the parent document". > > > > Yet is there any way to preserve the hierarchy in the response? I really > > need to find the way to preserve the structure in the response. > > > > Thank you in advance! > > > > -- > > Alisa Zhila > > ---------------------------------------------------------------------- > > > > > > -- > Sincerely yours > Mikhail Khludnev > Principal Engineer, > Grid Dynamics > > <http://www.griddynamics.com> > <mkhlud...@griddynamics.com> >