zoukankan      html  css  js  c++  java
  • Solr部分更新MultiValued的Date日期字段时报错及解决方案:Invalid Date String:'Mon Sep 14 01:48:38 CST 2015'

    问题描述如标题。

    异常信息如下:

    Result
    Caused by: org.apache.solr.common.SolrException: Invalid Date String:'Mon Sep 14 01:48:38 CEST 2015'
    at org.apache.solr.util.DateFormatUtil.parseMath(DateFormatUtil.java:87)

    对应开源问题单:

    https://issues.apache.org/jira/browse/SOLR-8050

    solr5.4 solr6.0版本修复了该问题。而cloudera的社区版还存在该问题。

    规避思路:虽然日期字段不支持部分更新,可以先转换为string字段,再通过copyField到日期字段。

    <!--customer_doc-->
       <field name="phone_in_history_date_china_str" type="string" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="phone_out_history_date_china_str" type="string" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="caller_history_date_china_str" type="string" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="history_record_date_china_str" type="string" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="phone_in_history_date_china" type="tdate" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="phone_out_history_date_china" type="tdate" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="caller_history_date_china" type="tdate" indexed="false" stored="true" multiValued="true" docValues="true"/>
       <field name="history_record_date_china" type="tdate" indexed="false" stored="true" multiValued="true" docValues="true"/>

    copyField:

    <copyField source="phone_in_history_date_china_str" dest="phone_in_history_date_china"/>
    <copyField source="phone_out_history_date_china_str" dest="phone_out_history_date_china"/>
    <copyField source="caller_history_date_china_str" dest="caller_history_date_china"/>
    <copyField source="history_record_date_china_str" dest="history_record_date_china"/>

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的【推荐】。
    如果,您希望更容易地发现我的新博客,不妨点击一下左下角的【关注我】。
    如果,您对我的博客所讲述的内容有兴趣,请继续关注我的后续博客,我是【Arli】。

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    tensorflow 1
    BAT变量中的百分号学习
    mysqldump: unknown option '--no-beep'
    mysql数据库文件默认保存目录(windows)
    mysql 直接从date 文件夹备份表,还原数据库之后提示 table doesn`t exist的原因和解决方法
    淘宝开源Web服务器Tengine安装教程
    Solr开发文档
    spring线程池配置
    Host 'XXX' is not allowed to connect to this MySQL server 解决方案/如何开启MySQL的远程帐号
    Redis应用场景
  • 原文地址:https://www.cnblogs.com/arli/p/6244468.html
Copyright © 2011-2022 走看看