Provides support for converting dates to strings and vice-versa.
The strings are structured so that lexicographic sorting orders by date,
which makes them suitable for use as field values and search terms.
Note that this class saves dates with millisecond granularity,
which is bad for {@link TermRangeQuery} and {@link PrefixQuery}, as those
queries are expanded to a BooleanQuery with a potentially large number
of terms when searching. Thus you might want to use
{@link DateTools} instead.
Note: dates before 1970 cannot be used, and therefore cannot be
indexed when using this class. See {@link DateTools} for an
alternative without such a limitation.
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#
long
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1
Syntax
C# |
---|
[ObsoleteAttribute("If you build a new index, use DateTools or NumericField instead.This class is included for use with existing indices and will be removed in a future release.")] public class DateField |
Visual Basic |
---|
<ObsoleteAttribute("If you build a new index, use DateTools or NumericField instead.This class is included for use with existing indices and will be removed in a future release.")> _ Public Class DateField |
Visual C++ |
---|
[ObsoleteAttribute(L"If you build a new index, use DateTools or NumericField instead.This class is included for use with existing indices and will be removed in a future release.")] public ref class DateField |