Solr架构中字段的默认值可以是当前日期吗? [英] Default value in a field in the Solr schema can be the current date?

查看:75
本文介绍了Solr架构中字段的默认值可以是当前日期吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Solr,我想在 schema.xml 中添加一个字段 last_update ,其中默认值将是添加或更新文档时的当前日期。

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.

你知道我该怎么办?

谢谢

推荐答案

这是支持的方案 >的DateField 。以下应该有效:

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

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

这篇关于Solr架构中字段的默认值可以是当前日期吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆