Mailing List Archive

DateField bug?
Before I enter this into Bugzilla, I thought I'd get a sanity check
here. I'm using DateField and indexing it like this:

doc.add(Field.Keyword("modified",
DateField.timeToString(file.lastModified())));

(I'm not using the Date variant of the Keyword method).

It indexes fine, but on retrieval, I'm doing this:

long time = DateField.stringToTime(indexModified);

And this is dying with this:

java.lang.NumberFormatException: d968b5t4
at java.lang.Long.parseLong(Long.java:310)
at org.apache.lucene.document.DateField.stringToTime(Unknown
Source)

This is occuring in 1.3-dev1 build, but not in the 1.2 build.

I checked a few sources in Lucene's CVS, but didn't spot anything with
relevant changes. But something is fishy somewhere. Can anyone spot
anything I'm doing wrong or offer any clues?

Also, the Field.Keyword(String, Date) method is setting the field to be
tokenized - is this appropriate? The Field.Keyword(String, String) does
not set that flag.

Thanks,
Erik


--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: DateField bug? [ In reply to ]
Erik,

I think both of those issues may already be in Bugzilla.... don't know
bug IDs.

Otis

--- Erik Hatcher <lists@ehatchersolutions.com> wrote:
> Before I enter this into Bugzilla, I thought I'd get a sanity check
> here. I'm using DateField and indexing it like this:
>
> doc.add(Field.Keyword("modified",
> DateField.timeToString(file.lastModified())));
>
> (I'm not using the Date variant of the Keyword method).
>
> It indexes fine, but on retrieval, I'm doing this:
>
> long time = DateField.stringToTime(indexModified);
>
> And this is dying with this:
>
> java.lang.NumberFormatException: d968b5t4
> at java.lang.Long.parseLong(Long.java:310)
> at org.apache.lucene.document.DateField.stringToTime(Unknown
>
> Source)
>
> This is occuring in 1.3-dev1 build, but not in the 1.2 build.
>
> I checked a few sources in Lucene's CVS, but didn't spot anything
> with
> relevant changes. But something is fishy somewhere. Can anyone spot
>
> anything I'm doing wrong or offer any clues?
>
> Also, the Field.Keyword(String, Date) method is setting the field to
> be
> tokenized - is this appropriate? The Field.Keyword(String, String)
> does
> not set that flag.
>
> Thanks,
> Erik
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-dev-help@jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: DateField bug? [ In reply to ]
Right you are... sorry for that message. The good news is that the
Field.Keyword(String, Date) issue was under two issues, so I marked one
as a duplicate. And I see the workaround to the timeToString issue - duh.

Thanks,
Erik


Otis Gospodnetic wrote:
> Erik,
>
> I think both of those issues may already be in Bugzilla.... don't know
> bug IDs.
>
> Otis
>
> --- Erik Hatcher <lists@ehatchersolutions.com> wrote:
>
>>Before I enter this into Bugzilla, I thought I'd get a sanity check
>>here. I'm using DateField and indexing it like this:
>>
>> doc.add(Field.Keyword("modified",
>> DateField.timeToString(file.lastModified())));
>>
>>(I'm not using the Date variant of the Keyword method).
>>
>>It indexes fine, but on retrieval, I'm doing this:
>>
>> long time = DateField.stringToTime(indexModified);
>>
>>And this is dying with this:
>>
>>java.lang.NumberFormatException: d968b5t4
>> at java.lang.Long.parseLong(Long.java:310)
>> at org.apache.lucene.document.DateField.stringToTime(Unknown
>>
>>Source)
>>
>>This is occuring in 1.3-dev1 build, but not in the 1.2 build.
>>
>>I checked a few sources in Lucene's CVS, but didn't spot anything
>>with
>>relevant changes. But something is fishy somewhere. Can anyone spot
>>
>>anything I'm doing wrong or offer any clues?
>>
>>Also, the Field.Keyword(String, Date) method is setting the field to
>>be
>>tokenized - is this appropriate? The Field.Keyword(String, String)
>>does
>>not set that flag.
>>
>>Thanks,
>> Erik
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:lucene-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail:
>><mailto:lucene-dev-help@jakarta.apache.org>
>>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>