我迷路了,需要你的建议。我有一个包含多级子文档的嵌套Solr文档。这里是一个JSON例子,所以你可以看到完整的结构:如何从solr读取嵌套结构?
{
"id": "Test Library",
"description": "example of nested document",
"content_type": "library",
"authors": [{
"id": "author1",
"content_type": "author",
"name": "First Author",
"books": [{
"id": "book1",
"content_type": "book",
"title": "title of book 1"
}],
"shortStories": [{
"id": "shortStory1",
"content_type": "shortStory",
"title": "title of short story 1"
}]
},
{
"id": "author2",
"content_type": "author",
"name": "Second Author",
"books": [{
"id": "book1",
"content_type": "book",
"title": "title of book 1"
}],
"shortStories": [{
"id": "shortStory1",
"content_type": "shortStory",
"title": "title of short story 1"
}]
}]
}
我想查询的文档和检索嵌套结构。我尝试使用ChildDocumentTranformerFactory但它扁平的结果是公正图书馆和所有其他文件孩子:
{
"id": "Test Library",
"description": "example of nested document",
"content_type": "library",
"_childDocuments_":[
{"id": "author1",
"content_type": "author",
"name": "First Author"
},
{"id": "book1",
"content_type": "book",
"title": "title of book 1"
},
{
"id": "shortStory1",
"content_type": "shortStory",
"title": "title of short story 1"
},
{
"id": "author2",
"content_type": "author",
"name": "Second Author"
},
{
"id": "book1",
"content_type": "book",
"title": "title of book 1"
},
{
"id": "shortStory1",
"content_type": "shortStory",
"title": "title of short story 1"
}
]
}
以下是查询参数我用:
q={!parent which='content_type:library'}
df=id
fl=*,[child parentFilter='content_type:library' childFilter='id:*']
wt=json
indent=true
什么是阅读的最好方式来自Solr的嵌套结构?我需要做一些刻面吗?
我使用Solr的版本5.2.1
你能否提供一个创建虚拟关系的例子? – jencoston