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 manju16832003 <ma...@gmail.com> on 2014/01/06 10:20:27 UTC

Re: Storing MYSQL DATETIME field in solr as String

I found a way to store MySQL DateTime as a string in Solr

Here is the way

in data-config.xml in the SQL query we could convert the date directly to
char

CAST(l.creation_date as char) as creation_date,
CAST(l.modification_date as char) as modification_date,

in schema.xml
<field name="creation_date" type="string" indexed="true" stored="true" 
multiValued="false" default="" />
<field name="modification_date" type="string" indexed="true" stored="true" 
multiValued="false" default="" />


Output would be 
 <str name="creation_date">2013-11-13 10:26:32</str>
 <str name="modification_date">2013-11-13 10:26:32</str>

This is exactly what I was looking for.

If you guys have any other wise please free to share. :-).

Happy Solr!!!





--
View this message in context: http://lucene.472066.n3.nabble.com/Storing-MYSQL-DATETIME-field-in-solr-as-String-tp4106836p4109720.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Storing MYSQL DATETIME field in solr as String

Posted by manju16832003 <ma...@gmail.com>.
Hi Tariq,
I'm glad that helped you :-).

Thanks



--
View this message in context: http://lucene.472066.n3.nabble.com/Solved-Storing-MYSQL-DATETIME-field-in-solr-as-String-tp4106836p4112979.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Storing MYSQL DATETIME field in solr as String

Posted by tariq <ya...@gmail.com>.
Hello manju,

Thank you! It's really helpful for me.



--
View this message in context: http://lucene.472066.n3.nabble.com/Solved-Storing-MYSQL-DATETIME-field-in-solr-as-String-tp4106836p4112977.html
Sent from the Solr - User mailing list archive at Nabble.com.