Class DateTools
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 TermRangeQuery and PrefixQuery will require more memory and become slower.
Another approach is NumericUtils, which provides a sortable binary representation (prefix encoded) of numeric values, which date/time are.
For indexing a
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public static class DateTools : object
Methods
Name | Description |
---|---|
DateToString(DateTime, DateTools.Resolution) | Converts a |
Round(DateTime, DateTools.Resolution) | Limit a date's resolution. For example, the date |
Round(Int64, DateTools.Resolution) | Limit a date's resolution. For example, the date |
StringToDate(String) | Converts a string produced by TimeToString(Int64, DateTools.Resolution) or
DateToString(DateTime, DateTools.Resolution) back to a time, represented as a
|
StringToTime(String) | Converts a string produced by TimeToString(Int64, DateTools.Resolution) or DateToString(DateTime, DateTools.Resolution) back to a time, represented as the number of milliseconds since January 1, 1970, 00:00:00 GMT (also known as the "epoch"). |
TimeToString(Int64, DateTools.Resolution) | Converts a millisecond time to a string suitable for indexing. |