DateTools
instead. For
existing indices you can continue using this class, as it will not be
removed in the near future despite being deprecated.public class DateField extends Object
Note that this class saves dates with millisecond granularity,
which is bad for RangeQuery
and PrefixQuery
, as those
queries are expanded to a BooleanQuery with a potentially large number
of terms when searching. Thus you might want to use
DateTools
instead.
Note: dates before 1970 cannot be used, and therefore cannot be
indexed when using this class. See DateTools
for an
alternative without such a limitation.
Modifier and Type | Method and Description |
---|---|
static String |
dateToString(Date date)
Deprecated.
Converts a Date to a string suitable for indexing.
|
static String |
MAX_DATE_STRING()
Deprecated.
|
static String |
MIN_DATE_STRING()
Deprecated.
|
static Date |
stringToDate(String s)
Deprecated.
Converts a string-encoded date into a Date object.
|
static long |
stringToTime(String s)
Deprecated.
Converts a string-encoded date into a millisecond time.
|
static String |
timeToString(long time)
Deprecated.
Converts a millisecond time to a string suitable for indexing.
|
public static String MIN_DATE_STRING()
public static String MAX_DATE_STRING()
public static String dateToString(Date date)
RuntimeException
- if the date specified in the
method argument is before 1970public static String timeToString(long time)
RuntimeException
- if the time specified in the
method argument is negative, that is, before 1970public static long stringToTime(String s)
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.