You might want to look at DateMath, http://lucene.apache.org/solr/api/org/apache/solr/util/DateMathParser.html. I believe the default precision is to the millisecond, so if you afford to round to the nearest second or even minute you might see some performance gains.
-Kallin Nagelberg -----Original Message----- From: Jan Simon Winkelmann [mailto:winkelm...@newsfactory.de] Sent: Thursday, April 29, 2010 4:36 AM To: solr-user@lucene.apache.org Subject: Slow Date-Range Queries Hi, I am currently having serious performance problems with date range queries. What I am doing, is validating a datasets published status by a valid_from and a valid_till date field. I did get a performance boost of ~ 100% by switching from a normal solr.DateField to a solr.TrieDateField with precisionStep="8", however my query still takes about 1,3 seconds. My field defintion looks like this: <fieldType name="date" class="solr.TrieDateField" precisionStep="8" sortMissingLast="true" omitNorms="true"/> <field name="valid_from" type="date" indexed="true" stored="false" required="false" /> <field name="valid_till" type="date" indexed="true" stored="false" required="false" /> And the query looks like this: ((valid_from:[* TO 2010-04-29T10:34:12Z]) AND (valid_till:[2010-04-29T10:34:12Z TO *])) OR ((*:* -valid_from:[* TO *]) AND (*:* -valid_till:[* TO *]))) I use the empty checks for datasets which do not have a valid from/till range. Is there any way to get this any faster? Would it be faster using unix-timestamps with int fields? I would appreciate any insight and help on this. regards, Jan-Simon