Filtering Parent documents based on Child documents Facets selection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Filtering Parent documents based on Child documents Facets selection

Abhay Kumar
I have a nested documents which I am syncing in Solr :

{
   "id":"NCT04372953",
   "title":"Positive End-Expiratory Pressure (PEEP) Levels During Resuscitation of Preterm Infants at Birth (The POLAR Trial) ",
   "phase":"N/A",
   "status":"Not yet recruiting",
   "studytype":"Interventional",
   "SponsorName":[
      "Murdoch Childrens Research Institute|Children''s Hospital of Philadelphia|University of Amsterdam"
   ],
   "SponsorRole":[
      "lead|collaborator"
   ],
   "source":"Murdoch Childrens Research Institute",
   "sponsorrole":[
      "lead",
      "collaborator"
   ],
   "sponsorname":[
      "Murdoch Childrens Research Institute",
      "Children''s Hospital of Philadelphia",
      "University of Amsterdam"
   ],
   "investigatorsaffiliation":"",
   "investigatorname":[
      ""
   ],
   "therapeuticareaname":"",
   "text_suggest":[
      ""
   ],
   "investigatorrole":"",
   "_version_":1680437253090836480,
   "sites":{
      "id":"51002566",
      "facilitytype":"Hospital",
      "facilityname":"The Royal Women''s Hospital, Melbourne Australia",
      "facilitycountry":"Australia",
      "facilitystate":"Victoria",
      "facilitycity":"Parkville",
      "nodetype":"cnode",
      "facilityzip":"",
      "_nest_parent_":"NCT04372953",
      "phase":"",
      "studytype":"",
      "investigatorsaffiliation":"",
      "source":"",
      "title":"",
      "sponsorrole":[
         ""
      ],
      "investigatorname":[
         ""
      ],
      "therapeuticareaname":"",
      "text_suggest":[
         ""
      ],
      "investigatorrole":"",
      "sponsorname":[
         ""
      ],
      "status":"",
      "_version_":1680437253090836480
   },
   "investigators":[
      {
         "id":"6300662",
         "investigatorname":[
            "Louise Owen"
         ],
         "nodetype":"cnode",
         "investigatorrole":"Principal Investigator",
         "investigatorsaffiliation":"The Royal Women''s Hospital, Melbourne Australia",
         "CongressScore":"",
         "TrialsScore":"Low",
         "PublicationScore":"",
         "_nest_parent_":"NCT04372953",
         "phase":"",
         "studytype":"",
         "source":"",
         "title":"",
         "sponsorrole":[
            ""
         ],
        "therapeuticareaname":"",
         "text_suggest":[
            ""
         ],
         "sponsorname":[
            ""
         ],
         "status":"",
         "_version_":1680437253090836480
      },
      {
         "id":"6426782",
         "investigatorname":[
            "David Tingay, MBBS FRACP"
         ],
         "nodetype":"cnode",
         "investigatorrole":"Study Chair",
         "investigatorsaffiliation":"Royal Children''s Hospital, Melbourne Australia",
         "CongressScore":"",
         "TrialsScore":"",
         "PublicationScore":"",
         "_nest_parent_":"NCT04372953",
         "phase":"",
         "studytype":"",
         "source":"",
         "title":"",
         "sponsorrole":[
            ""
         ],
         "therapeuticareaname":"",
         "text_suggest":[
            ""
         ],
         "sponsorname":[
            ""
         ],
         "status":"",
         "_version_":1680437253090836480
      },
      {
         "id":"7663364",
         "investigatorname":[
            "Omar Kamlin"
         ],
         "nodetype":"cnode",
         "investigatorrole":"Principal Investigator",
         "investigatorsaffiliation":"The Royal Women''s Hospital, Melbourne Australia",
         "CongressScore":"",
         "TrialsScore":"Low",
         "PublicationScore":"",
         "_nest_parent_":"NCT04372953",
         "phase":"",
         "studytype":"",
         "source":"",
         "title":"",
         "sponsorrole":[
            ""
         ],
         "therapeuticareaname":"",
         "text_suggest":[
            ""
         ],
         "sponsorname":[
            ""
         ],
         "status":"",
         "_version_":1680437253090836480
      }
   ],
   "therapeuticareas":[
      {
         "id":"ta-0-NCT04372953",
         "therapeuticareaname":"Premature Birth",
         "text_prefixauto":"Premature Birth",
         "text_suggest":[
            "Premature Birth"
         ],
         "diseaseareas":[
            ""
         ],
         "nodetype":"cnode",
         "_nest_parent_":"NCT04372953",
         "phase":"",
         "studytype":"",
         "investigatorsaffiliation":"",
         "source":"",
         "title":"",
         "sponsorrole":[
            ""
         ],
         "investigatorname":[
            ""
         ],
         "investigatorrole":"",
         "sponsorname":[
            ""
         ],
         "status":"",
         "_version_":1680437253090836480,
         "therapeuticareaname_facet":"Premature Birth",
         "diseaseareas_facet":[
            ""
         ]
      },
      {
         "id":"ta-1-NCT04372953",
         "therapeuticareaname":"Lung Injury",
         "text_prefixauto":"Lung Injury",
         "text_suggest":[
            "Lung Injury"
         ],
         "diseaseareas":[
            "Respiratory tract diseases"
         ],
         "nodetype":"cnode",
         "_nest_parent_":"NCT04372953",
         "phase":"",
         "studytype":"",
         "investigatorsaffiliation":"",
         "source":"",
         "title":"",
         "sponsorrole":[
            ""
         ],
         "investigatorname":[
            ""
         ],
         "investigatorrole":"",
         "sponsorname":[
            ""
         ],
         "status":"",
         "_version_":1680437253090836480,
         "therapeuticareaname_facet":"Lung Injury",
         "diseaseareas_facet":[
            "Respiratory tract diseases"
         ]
      }
   ]
}

1.            I need all the parent document, I am using following query to fetch Parent documents when checking for field therapeuticareas/therapeuticareaname.
http://localhost:8983/solr/ClinicalTrial2/select?q={!parent which='-nodetype:* *:*'}therapeuticareaname:lung

2. I am using following query to Get Facets for diseaseareas and therapeuticareaname fields :
http://localhost:8983/solr/ClinicalTrial2/select?q={!parent which='-nodetype:* *:*'}therapeuticareaname:lung&fl=*,[child%20limit=500]&json.facet={ diseaseareas : { domain:{blockChildren:\"nodetype: pnode\"}, type: terms, field: diseaseareas_facet, limit:-1, ctfacet: { documentsCount: \"unique(_root_)\" } }, therapeuticareas : { domain:{blockChildren:\"nodetype: pnode\"}, type: terms, field: therapeuticareaname_facet, limit:-1, ctfacet: { documentsCount: \"unique(_root_)\" } }}

Now, when I am seleting Facets for diseaseareas and therapeuticareaname fields on UI, I want to filter my records.
3. When using below query it is giving 0 records

http://localhost:8983/solr/ClinicalTrial2/query?q={!parent which='-nodetype:cnode *:*' filters=$child.fq}therapeuticareaname:(lung)&child.fq=(diseaseareas:(("Infectious+diseases")))&fl=*,score,[child limit=500]&start=0&rows=20

Please suggest how to filter records based on Child documents Facets.

Thanks.
Abhay

Confidentiality Notice
====================
This email message, including any attachments, is for the sole use of the intended recipient and may contain confidential and privileged information. Any unauthorized view, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. Anju Software, Inc. 4500 S. Lakeshore Drive, Suite 620, Tempe, AZ USA 85282.