Provides support for converting dates to strings and vice-versa.
The strings are structured so that lexicographic sorting orders
them by date, which makes them suitable for use as field values
and search terms.
This class also helps you to limit the resolution of your dates. Do not
save dates with a finer resolution than you really need, as then
RangeQuery and PrefixQuery will require more memory and become slower.
Compared to {@link DateField} the strings generated by the methods
in this class take slightly more space, unless your selected resolution
is set to or lower.
Another approach is {@link NumericUtils}, which provides
a sortable binary representation (prefix encoded) of numeric values, which
date/time are.
For indexing a {@link Date} or {@link Calendar}, just get the unix timestamp as
using {@link Date#getTime} or {@link Calendar#getTimeInMillis} and
index this as a numeric value with {@link NumericField}
and use {@link NumericRangeQuery} to query it.
CopyC#
Resolution.DAY
CopyC#
long
The DateTools..::..Resolution type exposes the following members.
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | (Overrides Object..::..ToString()()()().) |