My e-book has an example of an update processor that rounds to any specified
resolution (e.g, day, year, hour, etc.)
The performance reason was for filter queries, to keep their uniqueness
down, not random user queries, which should be fine unrounded, except that
they can't be used for exact query matches such as year without expanding
the date to a range for the full interval.
-- Jack Krupansky
-----Original Message-----
From: Dmitry Kan
Sent: Friday, May 9, 2014 6:41 AM
To: solr-user@lucene.apache.org
Subject: date range queries efficiency
Hi,
There was a mention either on solr wiki or on this list, that in order to
optimize the date range queries, it is beneficial to round down the range
values.
For example, if a range query is:
DateTime:[NOW-3DAYS TO NOW]
then if the precision up to msec is not required, we can safely round that
down to a day or hour, for example:
DateTime:[NOW-3DAYS/DAY TO NOW/DAY]
DateTime:[NOW-3DAYS/HOUR TO NOW/HOUR]
What I'm wondering about is what other optimizations would make sense here
on the indexing side? Luke shows that solr stores dates as longs with
millisecond precision. So this seems to utilize the efficient Lucene
numeric range queries internally.
If we do not need msec precision on dates during search, does it make sense
to also "round" dates down during indexing? Are there any other tips and
tricks for efficient date range queries?
Thanks!
--
Dmitry
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan