如何使用Solr查询同时检索父级和子级

时间:2019-07-26 09:59:01

标签: solr lucene

我已经在Solr中索引了以下文档

[
  {
    "id": "1",
    "title": "Cooking Recommendations",
    "tags": ["cooking", "meetup"],
    "_childDocuments_": [{
        "id": "2",
        "title_child": "Cookies"
      },
      {
        "id": "5",
        "title_child": "Cakes"
      }
    ]
  },
  {
    "id": "6",
    "title": "For Hire",
    "tags": ["professional", "jobs"],
    "_childDocuments_": [{
        "id": "7",
        "title_child": "Search Engineer"
      },
      {
        "id": "10",
        "title_child": "Low level Engineer"
      },
      {
        "id": "11",
        "title_child": "Software Engineer"
      }
    ]
  }
]

我正在查询父文档,以使用对子文档的过滤器来检索父及其子文档。

q=title:"Cooking"
fl=*,[child childFilter=title:"Cookies"]

我回答我只得到上级文件

"response":{"numFound":1,"start":0,"docs":[
      {
        "id":"1",
        "title":["Cooking Recommendations"],
        "tags":["cooking",
          "meetup"],
        "_version_":1640112506451001344}]
  }

我尝试删除子过滤器以获取所有子文档,但是响应是相同的。

我正在使用solr 8.1.1

0 个答案:

没有答案