【问题标题】:Solr : importing dynamic field names from XML with DIH and xpathSolr:使用 DIH 和 xpath 从 XML 导入动态字段名称
【发布时间】:2013-07-27 05:56:28
【问题描述】:

我正在从 XML 文件中索引数据,在 DataImportHandler 的 dataconfig.xml 中声明了许多类似这样的字段:

<field column="pos_A" xpath="/positions/pos_A/@pos" />
<field column="pos_B" xpath="/positions/pos_B/@pos" />
<field column="pos_C" xpath="/positions/pos_C/@pos" />
...

schema.xml 中有一个匹配的 dynamicField 声明:

<dynamicField name="pos_*" type="sint" indexed="true" stored="true" />

我想知道是否可以使用transformerdataconfig.xml 中动态生成字段名称,并且只有一行,有点像:

<field column="pos_{$1}" xpath="/positions/pos_(*)/@pos" />

(请原谅我的 xpath 和正则表达式语法 :)

【问题讨论】:

    标签: regex xpath solr dataimporthandler transformer


    【解决方案1】:

    https://issues.apache.org/jira/browse/SOLR-3251 最新版本声称您可以动态地将字段添加到架构中。我试图找到公共接口的文档,但到目前为止运气不佳。

    >

    SOLR-4658: In preparation for REST API requests that can modify the schema,
    126   a "managed schema" is introduced.  
    127   Add '<schemaFactory class="ManagedSchemaFactory" mutable="true"/>' to solrconfig.xml
    128   in order to use it, and to enable schema modifications via REST API requests.
    129   (Steve Rowe, Robert Muir)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-10
      • 1970-01-01
      相关资源
      最近更新 更多