org.apache.lucene.document
Class DateField
- java.lang.Object
-
- org.apache.lucene.document.DateField
-
Deprecated.If you build a new index, useDateToolsinstead. This class is included for use with existing indices and will be removed in a future release.
public class DateField extends java.lang.ObjectProvides 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
RangeQueryandPrefixQuery, as those queries are expanded to a BooleanQuery with a potentially large number of terms when searching. Thus you might want to useDateToolsinstead.Note: dates before 1970 cannot be used, and therefore cannot be indexed when using this class. See
DateToolsfor an alternative without such a limitation.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description static java.lang.StringdateToString(java.util.Date date)Deprecated.Converts a Date to a string suitable for indexing.static java.lang.StringMAX_DATE_STRING()Deprecated.static java.lang.StringMIN_DATE_STRING()Deprecated.static java.util.DatestringToDate(java.lang.String s)Deprecated.Converts a string-encoded date into a Date object.static longstringToTime(java.lang.String s)Deprecated.Converts a string-encoded date into a millisecond time.static java.lang.StringtimeToString(long time)Deprecated.Converts a millisecond time to a string suitable for indexing.
-
-
-
Method Detail
-
MIN_DATE_STRING
public static java.lang.String MIN_DATE_STRING()
Deprecated.
-
MAX_DATE_STRING
public static java.lang.String MAX_DATE_STRING()
Deprecated.
-
dateToString
public static java.lang.String dateToString(java.util.Date date)
Deprecated.Converts a Date to a string suitable for indexing.- Throws:
java.lang.RuntimeException- if the date specified in the method argument is before 1970
-
timeToString
public static java.lang.String timeToString(long time)
Deprecated.Converts a millisecond time to a string suitable for indexing.- Throws:
java.lang.RuntimeException- if the time specified in the method argument is negative, that is, before 1970
-
stringToTime
public static long stringToTime(java.lang.String s)
Deprecated.Converts a string-encoded date into a millisecond time.
-
stringToDate
public static java.util.Date stringToDate(java.lang.String s)
Deprecated.Converts a string-encoded date into a Date object.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG