lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Koberg <...@koberg.com>
Subject Re: sorting by date (XML)
Date Tue, 27 Apr 2004 18:09:19 GMT
Otis Gospodnetic wrote:

> Because having small time units like milliseconds will result in Range
> query expanding to a large number of BooleanQueries, if you have a lot
> of documents with unique time stamps.  Rounding the timestamp to
> minutes, hours, or days, can drastically reduce the number of unique
> time stamps, hence resulting in less BooleanQueries.

Cool, thanks. So DateField.dateToString is the best, most efficient way, 
correct?

> 
> Otis
> 
> --- Robert Koberg <rob@koberg.com> wrote:
> 
>>Otis Gospodnetic wrote:
>>
>>
>>>Beware of storing timestamps (DateFields, I guess) in Lucene, if
>>
>>you
>>
>>>intend to use range queries (xxx TO yyy).
>>
>>Why?
>>
>>We have attributes that contain iso8601 date strings and when
>>indexing:
>>
>>Date date = isoConv.parse(value, new ParsePosition(0));
>>String dateString = DateField.dateToString(date);
>>doc.add(Field.Keyword(name, dateString));
>>
>>then when searching:
>>
>>String from = DateField.timeToString(searchFromDate);
>>String to = DateField.timeToString(searchToDate);
>>RangeQuery rq = new RangeQuery(new Term(searchKey, from),
>>                            new Term(searchKey, to), true);
>>
>>Is this not correct?
>>
>>bst,
>>-Rob



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


Mime
View raw message