Solr Indexing My SQL Timestamp or Date Time field

╄→尐↘猪︶ㄣ 提交于 2019-12-23 01:28:40

问题


To index Date in Solr, Date should be in ISO format. Can we index MySQL Timestamp or Date Time feild with out modifying SQL Select Statement ?

I have used

 <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6"     positionIncrementGap="0"/>

 <field name="CreatedDate" type="tdate" indexed="true" stored="true" />

 CreatedDate is of Type Date Time in MySQL

I am getting following exception

 11:23:39,117 WARN  [org.apache.solr.handler.dataimport.DateFormatTransformer] (Thread-  72) Could not parse a Date field : java.text.ParseException: Unparseable date: "2013-04-14 11:22:48.0"

Any help in fixing this Issue is really appreciated


回答1:


Check Default nature of datetime field in SOLR

DatefieldSOLR

Convert Your datetime value with following mysql function

SELECT id,DATE_FORMAT(created_at,'%Y-%m-%dT%TZ') as created_at,... from table


来源:https://stackoverflow.com/questions/16000962/solr-indexing-my-sql-timestamp-or-date-time-field

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