You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "JuaNiK ." <js...@gmail.com> on 2008/08/12 12:48:44 UTC

Solr changes date format?

Hello,

i've integrated succesfully Solr with the Fedora repository, and my searches
from Solr web admin
interface work fine, but i have problems when i try to access from another
web front-end.

This is the error i get:

java.text.ParseException: Unparseable date: "2008-08-06T22:25:36,388Z"
    at java.text.DateFormat.parse(DateFormat.java:335)
    at
org.apache.solr.client.solrj.util.ClientUtils.parseDate(ClientUtils.java:145)
...

Date properties are correctly saved at the repository, and milliseconds are
separated
by a point but, as you can see, the separator is converted to a comma when
is accesed
from Solr (i can see this too from Solr web admin)

i've checked my schema.xml and solrconfig.xml files and i can't find the
reason why Solr
is changing the original date format.

thanks in advance,
Juan Fuertes

Re: Solr changes date format?

Posted by "JuaNiK ." <js...@gmail.com>.
Hi,

Hoss,
i was sure about the problem being at the comma change over the data,
and the trace
was obvious about that, and i think what Wunder have said it is 100%
the point i've looking for.

i should have said on my post that i'm mixing java apps and
internacionalization stuff it is an
important part of the front end.
trying to fix it now, knowing that is a locale problem (stupid me)

i'm using 1.3 and the XML response to searches from the web admin (as
i tried to 'silently' say),
of course, still shows the comma for the msecs.

thanks both for the quick response,

juan


On Tue, Aug 12, 2008 at 8:48 PM, Walter Underwood
<wu...@netflix.com> wrote:
>
> On 8/12/08 11:42 AM, "Chris Hostetter" <ho...@fucit.org> wrote:
>
> > : by a point but, as you can see, the separator is converted to a comma when
> > : is accesed
> > : from Solr (i can see this too from Solr web admin)
> >
> > this boggles my mind ... i can't think of *anything* in Solr that would do
> > this ..
>
> If a European locale was used when the seconds portion of the date
> was formatted, it would use a comma for the radix point.
>
> wunder
>

Re: Solr changes date format?

Posted by "JuaNiK ." <js...@gmail.com>.
> : If a European locale was used when the seconds portion of the date
> : was formatted, it would use a comma for the radix point.
>
> But nothing in DateField relies on the default locale -- we don't even use
> DateFormatter's for milliseconds anymore because of the trailing zero
> problem ....  uhhhhh ... hmmm, okay wait a minute, maybe the problem is
> the *DecimalFormat* ... it looks like it probably pays attention to
> the default Locale.  crap.
>
> JuaNiK: do you know what the default Locale of your jvm is?  Can you try
> running the Solr unit tests (specificly DateFieldTest) and (assuming it
> fails) file a bug with the results?

Hoss, the default Locale  of my jvm is:

user.country : ES
user.language : es

i just ran DateFieldTest and it fails as Stefan Oestreicher said in a recent
message. I was applying exactly the same solution than him but over
DateField.java





>
>
> -Hoss
>
>

Re: Solr changes date format?

Posted by Chris Hostetter <ho...@fucit.org>.
: > this boggles my mind ... i can't think of *anything* in Solr that would do
: > this .. 
: 
: If a European locale was used when the seconds portion of the date
: was formatted, it would use a comma for the radix point.

But nothing in DateField relies on the default locale -- we don't even use 
DateFormatter's for milliseconds anymore because of the trailing zero 
problem ....  uhhhhh ... hmmm, okay wait a minute, maybe the problem is 
the *DecimalFormat* ... it looks like it probably pays attention to 
the default Locale.  crap.

JuaNiK: do you know what the default Locale of your jvm is?  Can you try 
running the Solr unit tests (specificly DateFieldTest) and (assuming it 
fails) file a bug with the results?


-Hoss


Re: Solr changes date format?

Posted by Walter Underwood <wu...@netflix.com>.
On 8/12/08 11:42 AM, "Chris Hostetter" <ho...@fucit.org> wrote:

> : by a point but, as you can see, the separator is converted to a comma when
> : is accesed
> : from Solr (i can see this too from Solr web admin)
> 
> this boggles my mind ... i can't think of *anything* in Solr that would do
> this .. 

If a European locale was used when the seconds portion of the date
was formatted, it would use a comma for the radix point.

wunder


Re: Solr changes date format?

Posted by Chris Hostetter <ho...@fucit.org>.
: java.text.ParseException: Unparseable date: "2008-08-06T22:25:36,388Z"
:     at java.text.DateFormat.parse(DateFormat.java:335)
:     at
: org.apache.solr.client.solrj.util.ClientUtils.parseDate(ClientUtils.java:145)
: ...

please post the full stack trace ... it's not even clear from wha you've 
told us wether you aregetting this error when attempting to add a document 
or when searching, and even if it's when searching, it's not clear if this 
error is happening because of a malformed string in the response, or if 
it's attempting to format a Date object you are using as part of the query 
(ie: a facet.date param)

: by a point but, as you can see, the separator is converted to a comma when
: is accesed
: from Solr (i can see this too from Solr web admin)

this boggles my mind ... i can't think of *anything* in Solr that would do 
this .. cna you send out an example of hte raw XML you get when doing a 
simple query using the Solr admin interface, along with the corrisponding 
<field> declaration and <fieldType> declaration (as well as the details of 
which Solr version you are using)

The only thingi can think of is that in Solr 1.1 (and 1.2? can't remember) 
the DateField was completely trusting of it's input, and wouldnt' sanity 
check that it even remotely looked like a date -- so perhaps it wasn't 
actaully formated correctly when it was indexed. (if that's your problem, 
then running the same code against the Solr trunk should cause an error 
when indexing)


-Hoss