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 Toby White <to...@timetric.com> on 2010/04/30 13:23:59 UTC

Solr date representation

Don't know if this counts as a bug report or not - it's certainly a  
corner case, but it's just bitten me.

http://wiki.apache.org/solr/IndexingDates suggests that the canonical  
form of a date is a string like: 1995-12-31T23:59:59Z

and says that this is a "restricted form of the canonical  
representation of dateTime" from XML Schema.

The latter explicitly says "'0001' is the lexical representation of  
the year 1 of the Common Era (1 CE, sometimes written "AD 1" or "1 AD")"

However, if I put a document into Solr (1.4 release) with a datetime  
field of

0001-01-01T00:00:00Z

then on retrieving that document, I get back the value

1-01-01T00:00:00Z

(ie no preceding zeroes) - which tripped up my date-parsing routines.  
Preceding zeroes seem to be universally dropped - all dates before  
1000AD seem to have the equivalent problem.

Is this a bug in the code, or a bug in the documentation?

Toby

-- 
http://timetric.com
2nd Floor, White Bear Yard, 144a Clerkenwell Road, London EC1R 5DF
twitter: @timetric, @tow21 | skype: tobyohwhite


Re: Solr date representation

Posted by Chris Hostetter <ho...@fucit.org>.
: then on retrieving that document, I get back the value
: 
: 1-01-01T00:00:00Z
: 
: (ie no preceding zeroes) - which tripped up my date-parsing routines.
: Preceding zeroes seem to be universally dropped - all dates before 1000AD seem
: to have the equivalent problem.
: 
: Is this a bug in the code, or a bug in the documentation?

It's a bug in the code, thans for pointing this out...

https://issues.apache.org/jira/browse/SOLR-1899



-Hoss