[ 
https://issues.apache.org/jira/browse/SOLR-470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man reassigned SOLR-470:
-----------------------------

    Assignee: Hoss Man

a quick glance at the code verifies this (to me anyway ... i haven't written a 
test case for it)

I believe the problem only exists when dealing with DateMath relative to an 
absolute date ... when indexing or querying on a pure date value (ie: ending 
with a Z) the SimpleDateFormatter isn't used, so the milliseconds are still 
optional.

The ThreadLocalDateFormat helper was introduced in Solr 1.2, but this bug 
shouldn't affect 1.2 because it didn't support date math relative anything 
except "NOW"

The root of the problem is that when i added the ThreadLocalDateFormat before 
1.2, i tried to make it clear in the javadocs it was only for formatting, not 
for parsing...

{code}
  /**
   * Returns a formatter that can be use by the current thread if needed to
   * convert Date objects to the Internal representation.
   */
  protected DateFormat getThreadLocalDateFormat() {
{code}

....but when i generalized the DateMath support i forgot to read my own javadoc 
and starte using it for parsing as well.

There's no simple way (that i know of) to make a SimpleDateFormatter support 
optional milliseconds.  So the most straight forward fix is probably to use a 
(Parsing) Formatter that stops reading before the milliseconds, and then add 
them manually -- this means two seperate SimpleDateFormatters, (one for parsing 
and one for formatting) but that's "OK" since we never said the existing one 
was safe for parsing anyway.


> DateField throws error on iso8601 date
> --------------------------------------
>
>                 Key: SOLR-470
>                 URL: https://issues.apache.org/jira/browse/SOLR-470
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.3
>            Reporter: patrick o'leary
>            Assignee: Hoss Man
>
> A correct iso 8601 date 2006-01-01T12:01:00Z throws an error.
> Unparseable date: "2006-01-01T12:01:00Z" at 
> org.apache.solr.schema.DateField.toObject(DateField.java:173) at 
> org.apache.solr.schema.DateField.toObject(DateField.java:83)
> The ThreadLocalDateFormat requires fractional seconds 
> "yyyy-MM-dd'T'HH:mm:ss.SSS"
> to parse with simple date format. Where as the jdoc states their optional.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to