Static field for document in Data Import Handlerfor Solr

穿精又带淫゛_ 提交于 2020-03-16 07:43:26

问题


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>  

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?


回答1:


<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> 


来源:https://stackoverflow.com/questions/20936032/static-field-for-document-in-data-import-handlerfor-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!