lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <s...@elyograg.org>
Subject Re: Importing of unix date format from mysql database and dates of format 'Thu, 06 Sep 2012 22:32:33 +0000' in Solr 4.0
Date Fri, 07 Sep 2012 21:46:30 GMT
On 9/6/2012 6:54 PM, kiran chitturi wrote:
> The error i am getting is 'org.apache.solr.common.SolrException: Invalid
> Date String: '1345743552'.
>
>   I think it was being saved as a string in DB, so i will use the
> DateFormatTransformer.

To go along with all the other replies that you have gotten:  I import 
from MySQL with a unix format date field.  It's a bigint, not a string, 
but a quick test on MySQL 5.1 shows that the function works with strings 
too.  This is how my SELECT handles that field - I have MySQL convert it 
before it gets to Solr:

from_unixtime(`d`.`post_date`) AS `pd`

When it comes to the character set issues, this is how I have defined 
the driver in the dataimport config.  The character set in the database 
is utf8.

   <dataSource type="JdbcDataSource"
     driver="com.mysql.jdbc.Driver"
     encoding="UTF-8"
url="jdbc:mysql://${dataimporter.request.dbHost}:3306/${dataimporter.request.dbSchema}?zeroDateTimeBehavior=convertToNull"
     batchSize="-1"
     user="<removed>"
     password="<removed>"/>

Thanks,
Shawn


Mime
View raw message