lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: index sql databases
Date Fri, 15 Jul 2016 20:55:17 GMT
On 7/15/2016 12:42 PM, kostali hassan wrote:
> I use solr5.4.1 when a attribute the type date is null (0000:00:00)
> the processus of indexation stop and the log had an Error , how i have
> to change in driver="com.mysql.jdbc.Driver" to ignore null date; Last
> question how to set <field column="date_nais" name="date_nais_dt"
> dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" /> to to field
> date<yyyy-MM-dd> and time< hh:mm:ss>

An all-zero date is NOT a null date.  This is a valid date for MySQL,
but it is not a valid date for Solr, and Solr will complain about it.

You need to add a parameter to your JDBC URL to set zero dates to null,
so the field will not be present in the Solr document.  I am using this
parameter in my URL definition:

   
url="jdbc:mysql://${dih.request.dbHost}:3306/${dih.request.dbSchema}?zeroDateTimeBehavior=convertToNull"

I have no idea what you are trying to do with that <field> tag.  If the
MySQL field is a date/time field, JDBC will typically put it into the
correct format for Solr date field types.  About the only thing that
mightgo wrong is timezones -- you may need to explicitly set the
timezone with MySQL url parameters.

Thanks,
Shawn


Mime
View raw message