You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "ursswakesh@gmail.com" <ur...@gmail.com> on 2013/04/14 17:43:19 UTC

Solr Indexing My SQL Timestamp or Date Time field

Hi,

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 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Indexing-My-SQL-Timestamp-or-Date-Time-field-tp4055894.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Indexing My SQL Timestamp or Date Time field

Posted by Erick Erickson <er...@gmail.com>.
Solr requires precise date formats, see:
http://lucene.apache.org/solr/api-4_0_0-BETA/org/apache/solr/schema/DateField.html

Best
Erick

On Sun, Apr 14, 2013 at 11:43 AM, ursswakesh@gmail.com
<ur...@gmail.com> wrote:
> Hi,
>
> 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
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Indexing-My-SQL-Timestamp-or-Date-Time-field-tp4055894.html
> Sent from the Solr - User mailing list archive at Nabble.com.