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.

Otis

--- Robert Koberg <[EMAIL PROTECTED]> 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
> 
> 
> > 
> > Otis
> > 
> > --- Michael Wechner <[EMAIL PROTECTED]> wrote:
> > 
> >>my XML files contain something like
> >>
> >><date>
> >>  <year>2004</year><month>04</month><day>27</day>...
> >></date>
> >>
> >>and I would like to sort by this date.
> >>
> >>So I guess I need to modify the Documentparser and generate
> something
> >>like
> >>a millisecond field and then sort by this, correct?
> >>
> >>Has anyone done something like this yet?
> >>
> >>Thanks
> >>
> >>Michi
> >>
> >>-- 
> >>Michael Wechner
> >>Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
> >>http://www.wyona.com              http://cocoon.apache.org/lenya/
> >>[EMAIL PROTECTED]                        [EMAIL PROTECTED]
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail:
> [EMAIL PROTECTED]
> >>
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to