如何从solr中读取嵌套结构?
我迷路了,需要你的建议。我有一个嵌套的Solr文档,其中包含多个级别的子文档。下面是一个JSON示例,您可以看到完整的结构:如何从solr中读取嵌套结构?,solr,Solr,我迷路了,需要你的建议。我有一个嵌套的Solr文档,其中包含多个级别的子文档。下面是一个JSON示例,您可以看到完整的结构: { "id": "Test Library", "description": "example of nested document", "content_type": "library", "authors": [{ "id": "author1", "content_type": "author", "name":
{
"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,不幸的是,Solr目前不支持该版本 ChildDoctTransformerFactory返回嵌套在匹配父文档中的平面列表中与查询匹配的每个父文档的所有子文档
不确定是否有解决方法。请查看块连接,以实际关联父级和子级
能否提供一个创建虚拟关系的示例?