Hi,

as we all know, DateField currently leads to problems with range queries 
and prefix queries as it saves dates with millisecond precision. I suggest 
the following changes:

-Deprecate everything currently in DateField

-Add these methods to DateField:

  public static String dateToString(Date date, DateResolution resolution)
  public static String timeToString(long time, DateResolution resolution)

These will return strings in format "YYYYMM" if DateResolution is set to 
DateResolution.MONTH, "YYYYMMDDHHMM" if DateResolution is set to 
DateResolution.MINUTE etc. DateResolution is a typesafe enumeration. 
There's no default resolution, i.e. we force users to think about which 
resolution they need. The format is slightly longer than the radix one 
that's currently used, but it makes debugging easier. If a Date object is 
used, dates before 1970 can be indexed (which is not the case now).
  
  public static long dateStringToTime(String s) throws ParseException
  public static Date dateStringToDate(String s) throws ParseException
  
These accept any string created by the methods above. Implemented with
SimpleDateFormat.parse(). Throws a ParseException if the format is 
different to what is expected.

Alternative suggestion: deprecate the whole DateField class and create a 
new class DateString with the methods mentioned above.

Opinions?

Regards
 Daniel

-- 
http://www.danielnaber.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to