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.
Namespace: Lucene.Net.DocumentsCopyC#
Resolution.DAY
CopyC#
long
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1
Syntax
C# |
---|
public class DateTools |
Visual Basic |
---|
Public Class DateTools |
Visual C++ |
---|
public ref class DateTools |