lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Date Indexing
Date Thu, 17 Nov 2005 12:14:08 GMT

On 17 Nov 2005, at 07:06, Daniel.Clark@sybase.com wrote:
> I have a copy of the book.  It tells you how to index as I noted,  
> but not
> how to retrieve the date from search results.  document.get("date")  
> only
> returns Strings.  How do I get it to return the Date object?

As mentioned, DateField is the class to use to convert back.   
Retrieve the field as a String, then use DateField.stringToDate to  
convert it back to a date.

There are some references to it in the book, though not as well  
indexed, or placed, in the physical version as it should be.  Looking  
at lucenebook.com for DateField will show you where in the book it is  
mentioned.  Please take note of the caveats of using dates in this  
manner - I personally don't recommend it.

     Erik


>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Daniel Clark, Senior Consultant
> Sybase Federal Professional Services
> 6550 Rock Spring Drive, Suite 800
> Bethesda, MD  20817
> Office - (301) 896-1103
> Office Fax - (301) 896-1604
> Mobile - (703) 403-0340
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>              Erik Hatcher
>              <erik@ehatchersol
>               
> utions.com>                                                To
>                                        java-user@lucene.apache.org
>              11/17/2005  
> 07:00                                           cc
>              AM
>                                                                     
> Subject
>                                        Re: Date Indexing
>              Please respond to
>              java-user@lucene.
>                 apache.org
>
>
>
>
>
>
>
>
> On 17 Nov 2005, at 05:43, Daniel.Clark@sybase.com wrote:
>
>> I indexed dates using Field.Keyword(String,Date).  The values seem
>> to be
>> encoded when I retrieve them via document.get("date").  Luke
>> confirmed it.
>> How do I decode the Date when retrieving from Document object?  Or
>> does it
>> not work in version 1.4.3?  Also, does Lucene only sort String  
>> values?
>>
>
> What ya need is a brand new copy of Lucene in Action :)
>
>      <http://www.lucenebook.com/search?query=date+convert>
>
> Look at the DateField utilities.
>
>      Erik
>
>
>
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Daniel Clark, Senior Consultant
>> Sybase Federal Professional Services
>> 6550 Rock Spring Drive, Suite 800
>> Bethesda, MD  20817
>> Office - (301) 896-1103
>> Office Fax - (301) 896-1604
>> Mobile - (703) 403-0340
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message