Hiya, So I have some nested documents in my index with this kind of structure: { "id": “parent", "gridcell_rpt": "POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))", "density": “30"
"_childDocuments_" : [ { "id":"child1", "gridcell_rpt":"MULTIPOLYGON(((30 20, 45 40, 10 40, 30 20)))", "density":"25" }, { "id":"child2", "gridcell_rpt":"MULTIPOLYGON(((15 5, 40 10, 10 20, 5 10, 15 5)))", "density":"5" } ] } The parent document is a WKT shape, and its children are “grid cells”, which are just divisions of the main shape (ie; cutting up the parent shape to get children shapes). The “density" is the feature count in each shape. When I query (through the Solr UI) I use “Intersects” to return parents which touch the search area (note that if a child is touching, the parent must also be touching). eg; fq={!field f=gridcell_rpt}Intersects(POLYGON((-20 70, -50 80, -20 20, 30 60, -10 40, -20 70))) and I want to sort the results by the sum of the densities of all the children touching the search area (so which parent has children that touch the search area, and how big the sum of these children’s densities is) something like {!parent which=is_parent:true score=total v='+is_parent:false +{!func}density'} desc The problem is that this includes children that DON’T touch the search area in the sum. How can I only include the shapes from the first query above in my sort? Cheers :)