I think you have various approaches here: 1) using the block join hierarchical documents and the Children Query parser ( https://solr.apache.org/guide/8_11/other-parsers.html#block-join-children-query-parser). I have not played recently with multi-level hierarchy but should be doable and to roll up the sort you may work with the scoring, using a function query to calculate the score to propagate to the parents (or grandparents in your case)
2) Another option could be to flatten your data and then use field collapsing ( https://solr.apache.org/guide/8_11/collapse-and-expand-results.html) Cheers -------------------------- Alessandro Benedetti Apache Lucene/Solr Committer Director, R&D Software Engineer, Search Consultant www.sease.io On Sat, 20 Nov 2021 at 18:48, sachin gk <[email protected]> wrote: > Hi All, > > I am working on a query to roll up the sorting logic to parent documents > and honor the filter at the child level. The query I created is not working > as expected. > > please find the Document structure. > > Possible document Structure > > Parent (scope:parent) > Child (scope:child) > GrandChild (scope:GrandChild). PriceChild(scope:PriceChild). > (Both's parent is Chlld) > color(field) Price(field) > > > Say when the color field is used as a filter to query, which is at > GrandChild scope. It should consider eligible child document's > corresponding PriceChilds Price field for sorting to rollup to parent. > > Eg: PP1 > CC1, CC2 > GC10, GC20, PC10, PC20 > Blue, Black. 10, 20 > > Let's say if we apply for a given query a Blue color as a filter, it should > not consider Price 20 as it is child of CC2 and choose Price 10 for > sorting the PP1 document. > > > -- > Regards, > Sachin >
