Solr 8.6.2 Facets query for Nested documents

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

Solr 8.6.2 Facets query for Nested documents

Abhay Kumar

Hello Team,

 

I have sync following nested document in Solr 8.6.2.

 

{

   "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"

         ]

      }

   ]

}

 

 

Now, I am trying to query based on “therapeuticareaname” field. And I need following details.

 

  1. I need all the parent document, following query is working for me.

http://localhost:8983/solr/ClinicalTrial2/select?q={!parent which='-nodetype:* *:*'}therapeuticareaname:lung

  1. Now, I want the facet for the fields : therapeuticareaname, diseaseareas and facilityname fields.

I am using below query to get the facets :

 

http://localhost:8983/solr/ClinicalTrial2/select?q=(therapeuticareaname:lung)&json.facet={ diseaseareas : { type: terms, field: diseaseareas_facet, facet: { diseaseareaCount: "unique(_root_)" } }, therapeuticareas : { type: terms, field: therapeuticareaname_facet, facet: { therapeuticareaCount: "unique(_root_)" } }, facilities : { type: terms, field: facilityname, facet: { facilityCount: "unique(_root_)" } }}

 

But the issue that I have is, I am getting facets for therapeuticareaname and diseaseareas but not for the field “facilityname”.

 

Please help to form facet query to get the facets for the field “facilityname”.

 

Here is my output. :

 

 

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.