简体   繁体   中英

How to add same field in child documents in solr

I have the following indexed documents

{

"id":"data1",
"isParent":"1",
"_childDocuments":[
    {
        "description":"Benefit and Payroll consultant with HR team ",
        "isParent":"2",
        "exp":2
    },
    {
        "description":" ERP Avalon Implementation and Support Payroll",
        "isParent":"2",
        "exp":5
    }
]

}

When I search for children document whose exp is 7 I should get the above parent document.How can I achieve this.Please guide me.

You can use a block join query to let Solr know that you are looking to retertive the parent.

example http://localhost:8983/solr/collectionName?q= {!parent which=isParent:1}exp:7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM