On Sun, 2015-09-06 at 11:05 -0600, Shawn Heisey wrote:
> "querystring": "post_date:[2015-09-0124T00:00:00Z TO
> 2015-09-0224T00:00:00Z]",
> "parsedquery": "post_date:[1451692800000 TO 1460332800000]",
> 
> The "24" is from part of our code that interprets the hour, it was being
> incorrectly added.  We have since fixed the problem, but are somewhat
> confused that we did not get an error.

Solr uses Java's SimpleDateFormat with "yyyy-MM-dd'T'HH:mm:ss" as format
String. According to the JavaDocs for SimpleDateFormat, "For parsing,
the number of pattern letters is ignored unless it's needed to separate
two adjacent fields". Overflowing works for all the parts of the date
format.

SimpleDateFormat has a lenient-property. If set to false, it throws an
exception with your sample String. One could argue that lenient=true is
a bad default, but I would not consider it a bug in Java.


With Solr it is another matter. I do not know if it is a violation of
ISO-8601 to overflow the numbers, but as your post shows, it is probably
due to an error when it happens. The nice solution would be to use
lenient=false as default, and to allow overriding it in solrconfig.xml
for backwards compatibility.

- Toke Eskildsen, State and University Library, Denmark


Reply via email to