0
我試圖運行一個塊連接查詢來拉動子文檔,但我收到「父查詢生成父母過濾器不匹配的文檔」錯誤。 我使用Solr的5.5如何查詢子文檔的Solr
我的模式是這樣的:
<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>
Insert語句是這樣的:
{
"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"}
,我得到它我不希望給出的聲明「的孩子」的父文檔:
{
"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的5.3確實有辦法做到這一點得到孩子的家長/ @ alisazhila/Solr的-S-嵌套式-Solr的-S-能力到手柄深度嵌套的文檔結構,50eeaaa4347a – adam