fr.gouv.culture.sdx.search.lucene
Class DateField

java.lang.Object
  extended by fr.gouv.culture.sdx.search.lucene.DateField

public class DateField
extends java.lang.Object

Same code as org.apache.lucene.document.DateField but with changes to handle pre-1970 dates. Provides support for converting dates to strings and vice-versa. The strings are structured so that lexicographic sorting orders by date. This makes them suitable for use as field values and search terms.

Note: dates before 1970 CAN be used, and therefore CAN be indexed.


Method Summary
static java.lang.String dateToString(java.util.Date date)
          Converts a Date to a string suitable for indexing.
static java.lang.String MAX_DATE_STRING()
           
static java.lang.String MIN_DATE_STRING()
           
static java.util.Date stringToDate(java.lang.String s)
          Converts a string-encoded date into a Date object.
static long stringToTime(java.lang.String s)
          Converts a string-encoded date into a millisecond time.
static java.lang.String timeToString(long time)
          Converts a millisecond time to a string suitable for indexing, supports pre 1970 dates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

MIN_DATE_STRING

public static java.lang.String MIN_DATE_STRING()

MAX_DATE_STRING

public static java.lang.String MAX_DATE_STRING()

dateToString

public static java.lang.String dateToString(java.util.Date date)
Converts a Date to a string suitable for indexing. This method will throw a RuntimeException if the date specified in the method argument is before 1970.


timeToString

public static java.lang.String timeToString(long time)
Converts a millisecond time to a string suitable for indexing, supports pre 1970 dates.


stringToTime

public static long stringToTime(java.lang.String s)
Converts a string-encoded date into a millisecond time.


stringToDate

public static java.util.Date stringToDate(java.lang.String s)
Converts a string-encoded date into a Date object.



Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.