我已经用无模式模式链接了 dataimporthandler。如下所示,将配置参数“add-unknown-fields-to-the-schema”添加到 dataimporthandler 并配置所有内容。Dataimporthandler 导入数据并运行良好,但 solr 无法将未知字段添加到架构。它仅适用于现有字段。这是 dataimporthandler 对请求的回答。
{
"responseHeader": {
"status": 0,
"QTime": 0
},
"initArgs": [
"defaults",
[
"update.chain",
"add-unknown-fields-to-the-schema",
"config",
"db-data-config.xml"
]
],
"command": "status",
"status": "idle",
"importResponse": "",
"statusMessages": {
"Total Requests made to DataSource": "1",
"Total Rows Fetched": "273",
"Total Documents Processed": "273",
"Total Documents Skipped": "0",
"Full Dump Started": "2016-06-21 13:29:48",
"": "Indexing completed. Added/Updated: 273 documents. Deleted 0 documents.",
"Committed": "2016-06-21 13:29:49",
"Time taken": "0:0:0.543"
}
}
你可以看到我的配置没问题。下面是 solrconfig 文件。
<requestHandler name="/dataimport" class="solr.DataImportHandler">
<lst name="defaults">
<str name="update.chain">add-unknown-fields-to-the-schema</str>
<str name="config">db-data-config.xml</str>
</lst>
我希望能够从数据库中添加未知字段。