lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxim Patramanskij <>
Subject Re[2]: DateFilter or RangeQuery
Date Thu, 04 Dec 2003 16:34:11 GMT
Erik,  thanx a lot for your suggestion.

Dates currently used in the following way:

doc.add(Field.Keyword(FIELD_KEYWORD_MODIFIED, DateField.timeToString(docEnum.getLastModified())));

where is docEnum.getLastModified() is a file.lastModified()(i.e.

An index can contain up to 10000, so up to 10000 timestamps are
possible(and boolean query, thus, can contain that much!).

Yeah, it does not really needed to store timestamps and
thus I can really use your suggestion about "YYYYMMDD" date format,
cause I don't need more precise file dates.


EH> On Thursday, December 4, 2003, at 10:16  AM, Maxim Patramanskij wrote:
>> What is the better way to filter search results by date (which is one
>> of the indexed fields):
>>   - use RangeQuery against date field as a required part of boolean  
>> query;
>>   - use DateFilter
>>   First approach seems to be problematic since I have to extremely
>>   increase maxClauseCount of BooleanQuery and run again extra memory
>>   usage.

EH> DateFilter will be the better option if you do use the same date range 
EH> filter repeatedly - just keep the instance around and re-use it.

EH> A more general question, though, is are you truly just representing 
EH> dates? (and not timestamps)  If so, how many different dates are in the 
EH> index?

EH> If you are just using dates, I recommend using "YYYYMMDD" formatted 
EH> Field.Keyword(String, String) fields.  Don't use java.util.Date.  
EH> You'll get far fewer terms if you are just representing dates, and 
EH> RangeQuery might become a more viable option for you.

EH>         Erik

EH> ---------------------------------------------------------------------
EH> To unsubscribe, e-mail:
EH> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message