首页 > 解决方案 > Solr:仅从 JSON 文件中导入某些字段

问题描述

我在这个结构中有几个 JSON 文件:

{
  "book" : {
    "truncated" : "true",
    "title": "This is a very long book title and theref"
    "full_title" : "This is a very long book title and therefore it is truncated"
  }
}

或者它看起来像这样:

{
  "book" : {
    "truncated" : "false",
    "title": "This is a very short title"
  }
}

我想将这些文件导入 Solr 7.4.0。我的 schema.xml 有这个定义:

<field name="booktitle" type="string"/>

现在,当我导入数据时,我想总是取 的内容full_title,如果truncated为真,否则title。正确的机制是什么?

标签: jsonsolr

解决方案


推荐阅读