You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2005/12/06 10:35:41 UTC
Getting Dates Back out of lucene
I added a date field to a document with
doc.add(Field.keyword("A Date",myDate));
How do I get it back out again as a date?
--
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Getting Dates Back out of lucene
Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Tuesday 06 Dec 2005 10:10, Miles Barr wrote:
> On Tue, 2005-12-06 at 09:35 +0000, Alan Chandler wrote:
> > I added a date field to a document with
> >
> > doc.add(Field.keyword("A Date",myDate));
> >
> > How do I get it back out again as a date?
>
> You should be able to use the
> org.apache.lucene.document.DateField#stringToDate(String) method.
Thanks, exactly what I was looking for.
--
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Getting Dates Back out of lucene
Posted by Miles Barr <mi...@runtime-collective.com>.
On Tue, 2005-12-06 at 09:35 +0000, Alan Chandler wrote:
> I added a date field to a document with
>
> doc.add(Field.keyword("A Date",myDate));
>
> How do I get it back out again as a date?
You should be able to use the
org.apache.lucene.document.DateField#stringToDate(String) method.
Miles
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org