lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shalin Shekhar Mangar <shalinman...@gmail.com>
Subject Re: Storing MYSQL DATETIME field in solr as String
Date Mon, 16 Dec 2013 04:23:58 GMT
This is not a Solr specific problem. The java.sql.Timestamp class
which is what you get for a DateTime field contains a nano-second
component. This shows up as a .0 when you do a toString() conversion.
If you want to show this values to your client in a diffferent or
mysql-specific format, you can format the date value at display time.
Alternately, you can use the DateFormatTransformer to convert the date
into a string format of your choice before storing it into Solr.

See http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer

On Mon, Dec 16, 2013 at 9:11 AM, manju16832003 <manju16832003@gmail.com> wrote:
> Hi All,
> In database, MYSQL DateTime format is 2013-10-17 15:32:48 [yyyy-MM-dd
> hh:mm:ss] however, when I store this DateTime field in solr as String, it
> would look something like this  2013-10-17 15:32:48*.0*.
> Why the 0 is appended at the end of the DateTime?
>
> For the same date field, I do have another field in solr that stores date as
> UTC. The reason I'm storing date in String with different field to display
> user as it appears in MySQL database.
>
> But when DateTime stored as String in solr, it appends .0 end of the date.
> Is it the behaviour of Solr? is there a reason behind that?
>
> Thanks
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Storing-MYSQL-DATETIME-field-in-solr-as-String-tp4106836.html
> Sent from the Solr - User mailing list archive at Nabble.com.



-- 
Regards,
Shalin Shekhar Mangar.

Mime
View raw message