Solr 数据导入处理程序中文档的静态字段 [英] Static field for document in Data Import Handlerfor Solr
本文介绍了Solr 数据导入处理程序中文档的静态字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过以下方式从 db 中在 solr 中创建索引:
Im making an index in solr from db in the following way:
<document name="Index">
<entity name="c" query="SELECT * FROM C">
<field column="Name" name="name"/>
</entity>
<entity name="p" query="SELECT * FROM P">
<field column="Name" name="name"/>
</entity>
</document>
是否可以为每一行设置一个静态字段来表示返回给客户端的类型,以便可以根据来自 json 结果的信息调用正确的数据库表?
Is it possible to have a static field that is set for each row that signify what type is returned to client so that one can make a call to the right database table based on that information from the json result?
那个是表中没有列的字段
That is a field that has no column in the table
<field name="id" value="1"/>
或者有其他方法可以解决这个问题吗?
Or is there another way to solve this?
推荐答案
<document name="Index">
<entity name="c" transformer="TemplateTransformer" query="SELECT * FROM C">
<field column="Name" name="name"/>
<field column="id" template="1"/>
</entity>
<entity name="p" transformer="TemplateTransformer" query="SELECT * FROM P">
<field column="Name" name="name"/>
<field column="id" template="1"/>
</entity>
</document>
这篇关于Solr 数据导入处理程序中文档的静态字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文