Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr date field format

Tags:

solr

I'm a little confused on the proper format for the solr date fieldtype. When importing from a mySQL database does it need to be in this format?

1995-12-31T23:59:59Z

In my database the date and time fields are in different columns. Right now my query looks like this.

SELECT eb.eventID, concat(CAST(e.startDate AS CHAR),'T ',CAST(e.startTime as CHAR),'Z')

Am I on the right track?

like image 997
bikedorkseattle Avatar asked Feb 28 '12 19:02

bikedorkseattle


1 Answers

Yes, it does need to be in that format if you use the Solr "DateField" type: http://lucene.apache.org/solr/api/org/apache/solr/schema/DateField.html

I don't know the proper way to format dates in MySQL but you do want to make sure that the date is in the format yyyy-mm-dd and the time in the format HH:mi:ss.

like image 158
David Faber Avatar answered Nov 01 '22 01:11

David Faber