Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一点问题。我正在尝试将 SQL 文件导入 SOLR,但 SOLR 需要以下格式的日期时间:
1995-12-31T23:59:59Z
但是在 SQL 中使用 datetime 我只能采用这种格式:
1995-12-31 23:59:59
如果我将日期放在 varchar 字段中,那么我将无法在 SQL 文件上进行基于日期的计算。所以,我的问题是,我能否以某种方式让 SQL 接受 solr(第一)格式的日期时间?
如果您为您的字段使用标准 DateTime 类型,SOLR 将自动完成此转换,如下所示:
<field name="from_date" type="datetime" indexed="true" stored="true" />
如果它仍然不起作用,请使用以下方法转换您的日期:
DateTimeFieldSerializer date = new DateTimeFieldSerializer(); string fromDate = date.SerializeDate(myDate);