lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Tiger" <m.scott.ti...@gmail.com>
Subject performance of sorting by date
Date Thu, 06 Sep 2007 17:43:07 GMT
I want to search document by sorting datetime field mainly.
Which implementation is the best for sorting performance.

1. index the datetime as one field.

fields: title, contents, datetime

In this case, when there are documents that the datefield increases by 1
second between first of 2007 and end of 2007, the number of Term becomes
about 31536000 (seconds in 365 * 24 * 60 * 60).

2. index the datetime as 6 fields.

fields: title, contents, year, month, day, hour, minute, second.

In this case, Term of each field is,
 year : 1
 month : 12
 day : 31
 hour : 24
 minute : 60
 second : 60
totally, 188 terms. But sorting needs 6 field.

sample code:
String[] sortFields = { "year", "month", "day", "hour", "minute", "second"
};
Sort sort = new Sort(sortFields);
Hits hits = searcher.search(query, sort);

(3rd approach, index datetime as 2 field, yyyymmdd and hhmmss.)

I also need periodically about 1-10 minutes reopen index (add/delete
documents).


Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message