Default value in a field in the Solr schema can be the current date?

僤鯓⒐⒋嵵緔 提交于 2019-12-22 03:53:00

问题


I'm using Solr and I would like to add a field last_update in the schema.xml where the default value would be the current date when the document is added or updated.

Do you have an idea how can I do this?

Thanks


回答1:


It is a supported scenario for DateField. The following should work:

<field name="last_update" type="date" indexed="true" stored="true" default="NOW" />


来源:https://stackoverflow.com/questions/7317759/default-value-in-a-field-in-the-solr-schema-can-be-the-current-date

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