[英]Solr Nested Documents: query for parent document which has several specific nested documents
假设我有几个嵌套文档的文档:
{
"id": "doc1",
"type": "maindoc",
"title": "some document 1 title"
"nested": [
{
"id": "nested1",
"nested_type": "nestedType1",
"title": "nested doc 1 title"
},
{
"id": "nested2",
"nested_type": "nestedType2",
"title": "nested doc 2 title"
},
{
"id": "nested3",
"nested_type": "nestedType3",
"title": "nested doc 3 title"
}
]
}
所以现在如果我想搜索嵌套了 doc 1 的文档 - 我这样做:
{!parent which='type:maindoc'}
nested_type:nestedType1
但是,如果我想搜索同时有 2 个特定孩子的文档怎么办? 例如,我想找到同时具有nestedType1 + nestedType2 的文档。
显然这样的查询是行不通的:
{!parent which='type:maindoc'}
nested_type:nestedType1 AND nested_type:nestedType2
那么我该怎么做呢? 这有可能吗?
这样的事情在我的测试中起到了作用:
({!parent which='type:maindoc' v='nested_type:nestedType1'}) AND ({!parent which='type:maindoc' v='nested_type:nestedType2'})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.