0

我正在从 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" />

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

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

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

4

1 回答 1

0

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)
于 2013-07-26T21:50:01.910 回答