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

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

  • 相关阅读:
    Java 数据类型转换
    Perl 日期时间函数(date time)
    find a filename from a filehandle in Perl
    Perl文件读写
    R语言算术运算和逻辑运算
    bash/shell 数学计算
    grep/awk/sed 或者 并且 否定
    关于打印 毕业设计资料
    python 捕获 shell/bash 脚本的输出结果
    推荐几个高质量的图片素材网站
  • 原文地址:https://www.cnblogs.com/arli/p/6244468.html
Copyright © 2011-2022 走看看