Solr8.0.0 Time Zone Issue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr8.0.0 Time Zone Issue

Anuj Bhargava
In mySql, date field *date_upload* shows entry as 2019-04-17

However, afer Solr Indexing *date_upload* is being shown as
2019-04-16T18:30:00Z

I did change in solr.in.sh, SOLR_TIMEZONE="UTC"  to  SOLR_TIMEZONE="IST"
and did a full-import again. The entry in *date_upload* is still being
shown as 2019-04-16T18:30:00Z

The dataimport.properties is showing - #Thu Apr 18 07:20:42 UTC 2019

The Server Time is - Asia/Kolkata

How to get the same date as being shown in the main database
Reply | Threaded
Open this post in threaded view
|

Re: Solr8.0.0 Time Zone Issue

Shawn Heisey-2
On 4/18/2019 1:50 AM, Anuj Bhargava wrote:
> In mySql, date field *date_upload* shows entry as 2019-04-17
>
> However, afer Solr Indexing *date_upload* is being shown as
> 2019-04-16T18:30:00Z
>
> I did change in solr.in.sh, SOLR_TIMEZONE="UTC"  to  SOLR_TIMEZONE="IST"
> and did a full-import again. The entry in *date_upload* is still being
> shown as 2019-04-16T18:30:00Z

The timezone for Solr only affects date math -- queries that contain
things like NOW/DAY, NOW/WEEK, NOW/MONTH, etc.  It is so that Solr knows
when a day starts so it can calculate the proper time.  Timezone
settings do not affect date storage, date display, or indexing.  Those
will always be in the UTC timezone.

> The dataimport.properties is showing - #Thu Apr 18 07:20:42 UTC 2019
>
> The Server Time is - Asia/Kolkata
>
> How to get the same date as being shown in the main database

You will probably need to change your JDBC URL for mysql so that it
includes the timezone to use for the connection to the database.
Consult the mysql documentation to figure out how to do that.  I no
longer have access to the Solr installs where I changed this myself.

Thanks,
Shawn