On Mar 29, 2006, at 11:37 AM, Dennis Kubes wrote:
Looking at the Lucene In Action book it shows indexing Date fields with
something like this:



Field.Keyword("datefield", new Date());



I know that the APIs have changed for Field and I see that there are no
longer date constructors. So just confirming that we should use the
DateTools class and store dates as text to index?

That is correct.

I've upgraded the "Lucene in Action" codebase (locally, will release it when Lucene 2.0 ships) for the Lucene 2.0 API and here's what I did in the IndexBuilder class that used to use Field(String,Date):

String now = DateTools.dateToString(timestamp.getTime(), DateTools.Resolution.MILLISECOND); document.add(new Field("last-modified", now, Field.Store.YES, Field.Index.UN_TOKENIZED));

Erik



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to