我正在使用 Solr 来索引我的报告数据库。报告可以包含文本、提交者信息等。目前可以使用,如下所示:
"docs": [
{
"Text": "Some Report Text"
"ReportId": "1",
"Date": "2013-08-09T14:59:28.147Z",
"SubmitterId": "11111",
"FirstName": "John",
"LastName": "Doe",
"_version_": 1444554112206110700
}
]
报表可以拥有的另一件事是查看器(这是单个报表和查看器之间的一对多关系。)我希望能够在我的 JSON 输出中像这样捕获这些查看器:
"docs": [
{
"Text": "Some Report Text"
"ReportId": "1",
"Date": "2013-08-09T14:59:28.147Z",
"SubmitterId": "11111",
"FirstName": "John",
"LastName": "Doe",
"Viewers": [
{ ViewerId: "22222" },
{ ViewerId: "33333" }
]
"_version_": 1444554112206110700
}
]
然而,我似乎无法做到这一点。这是我的data-config.xml
(问题不需要的部分已删除):
<entity name="Report" query="select * from Reports">
<field column="Text" />
<field column="ReportId" />
<!-- Get Submitter Information as another entity. -->
<entity name="Viewers" query="select * from ReportViewers where Id='${Report.ReportId}'">
<field column="Id" name="ViewerId" />
</entity>
</entity>
和schema.xml
:
<field name="Text" type="text_en" indexed="true" stored="true" />
<field name="ReportId" type="string" indexed="true" stored="true" />
<field name="Viewers" type="string" indexed="true" stored="true" multiValued="true" />
<field name="ViewerId" type="string" indexed="true" stored="true" />
当我进行数据导入时,我什么也看不到。没有错误,没有明显错误,但我很确定我的数据配置和/或我的架构不正确。我究竟做错了什么?