【发布时间】:2016-12-04 05:17:23
【问题描述】:
我正在尝试运行块连接查询来提取子文档,但我收到“父查询产生的文档与父过滤器不匹配”错误。 我正在使用 Solr 5.5
我的架构如下所示:
<field name="url" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name" type="text_en" indexed="true" stored="true" required="true" multiValued="false" />
<field name="content_type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<uniqueKey>url</uniqueKey>
插入语句如下所示:
{
"url": "http://www.test.com/index.html",
"name": "parent product",
"content_type": "parentDocument",
"_childDocuments_": [
{
"url": "http://www.test.com/index2.html",
"name": "child product",
"content_type": "childDocument"
},
{
"url": "http://www.test.com/index3.html",
"name": "child product 2",
"content_type": "childDocument"
}
]
}
在控制台中运行标准 *:* 查询会拉回 3 个文档并显示子级属于其父级:
{
"docs": [
{
"url": "http://www.test.com/index2.html",
"name": "child product",
"content_type": "childDocument",
"_root_": "http://www.test.com/index.html"
},
{
"url": "http://www.test.com/index3.html",
"name": "child product 2",
"content_type": "childDocument",
"_root_": "http://www.test.com/index.html"
},
{
"url": "http://www.test.com/index.html",
"name": "test product",
"content_type": "parentDocument",
"_version_": 1541193313504198700,
"_root_": "http://www.test.com/index.html"
}
]
}
但是,如果我运行 q={!child of="content_type:parentDocument"},我会得到父文档,鉴于“child of”语句,我不会期望:
{
"responseHeader": {
"status": 0,
"QTime": 0,
"params": {
"q": "{!child of=\"content_type:parentDocument\"}",
"indent": "true",
"wt": "json"
}
},
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"url": "http://www.test.com/index.html",
"name": "test product",
"content_type": "parentDocument",
"_version_": 1541193313504198656,
"_root_": "http://www.test.com/index.html"
}
]
}
}
但是,如果我添加任何类型的查询,我会收到错误,例如
q={!child of="content_type:parentDocument"}name:product
甚至
q={!child of="content_type:parentDocument"}name:*
"父查询产生的文档与父过滤器不匹配,docID=0"
【问题讨论】:
标签: solr