lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael J. Prichard" <michael_prich...@mac.com>
Subject Re: Timestamps as milliseconds
Date Wed, 26 Jul 2006 19:52:09 GMT
Michael J. Prichard wrote:

> Miles Barr wrote:
>
>> Michael J. Prichard wrote:
>>
>>> I am working on indexing emails and have stored the data as 
>>> milliseconds.  I was thinking of using a filter w/ my search that 
>>> would only return the email in that data range.  I am currently 
>>> indexing as follows:
>>>
>>> doc.add(new Field("date", (String) 
>>> itemContent.get("date").toString(), Field.Store.YES, 
>>> Field.Index.UN_TOKENIZED));
>>>
>>> does this look like a good approach to you all?
>>>
>>
>> Using milliseconds as your resolutions will make range searches very 
>> slow, since it has to enumerate so many values. I suggest using at 
>> most minutes instead.
>>
>> But either way I suggest using DateTools rather than using a Date 
>> object's toString() form, i.e.:
>>
>> doc.add(new Field("date", 
>> DateTools.dateToString(itemContent.get("date"), 
>> DateTools.Resolution.MILLISECOND), Field.Store.YES, 
>> Field.Index.UN_TOKENIZED));
>>
>>
>>
>>
>> Miles
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
> I guess the more I think about it I don't really care about the 
> minutes in the initial.  All that matters is the date (i.e. 
> 2006-07-25).  The only thing I would need the time for would be for 
> sorting so I need to have that too.  Ideas?
>
> Thanks!
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

On this note....I want do a RangeQuery on the date (but I only care 
about YYYYMMDD).  What's the best way to index that?  I plan on storing 
the timestamp for sorting only.

Thanks.

---------------------------------------------------------------------
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