: OK, that being the case, is there a prescribed method for dealing with this?
: Does anybody have a "best practice" for me?

It depends on how/why you see it as a problem.

If all you want to do is sort on the date - you have no problem, they will
sort correctly.

If you want to display the date - Store the date with the value you want
to display, index the date using DateTools

If you want to use the dates in RangeFilters - Tell your users to "think
globally" :) ... or use a finer level of granularity (ie: hours) to
decrease the suprising descrepency.

or you can just use your own DateFormat with the TimeZone set to whatever
you want.

(In Solr, we just said "screw imprecision, screw ambiguity" and defined a
DateField using the XML schema part 2 dateTime specification; with
mandatory franctional seconds in UTC -- so clients allways know what to
expect ... that doesn't mean less precise field types can't be defined
later, just that we wanted the defaut to handle every possibility)


:
: -----Original Message-----
: From: Chris Hostetter [mailto:[EMAIL PROTECTED]
: Sent: Thursday, August 24, 2006 2:21 AM
: To: java-user@lucene.apache.org
: Subject: Re: DateTools.set-
:
:
: I think the confusion here is that when DateTools looks at a Date object and
: a Resolution, it does it's calculations in GMT (so when you ask what "day"
: it is at a particular moment, it tells you the current day in GMT, when you
: ask which month, it tells you the month in GMT, etc...)
:
: This may seem arbitrary, and it is, but it's fixed like that so that no
: matter what Locale your jvm is configured with, you'll get the same results
: from an index as everybody else.
:
: If you print the Date object with a robust DateFormatter (instead of the
: default toString()) you'll see what i mean.
:
:
:
: : Date: Thu, 24 Aug 2006 00:11:17 -0500
: : From: Paul Snyder <[EMAIL PROTECTED]>
: : Reply-To: java-user@lucene.apache.org
: : To: java-user@lucene.apache.org
: : Subject: DateTools.set-
: :
: : I have a question about DateTools conversions.  I am having trouble with
: : results of trying to store a date truncated to DAY resolution.
: :
: : Here is an example.
: :
: :
: ----------------------------------------------------------------------------
: : ----
: :
: : OK:
: :
: : DateTools.stringToDate(DateTools.dateToString(new Date("01/12/2006"),
: : DateTools.Resolution.SECOND))
: :      (java.util.Date) Thu Jan 12 00:00:00 CST 2006
: :
: : NOT OK:
: :
: : DateTools.stringToDate(DateTools.dateToString(new Date("01/12/2006"),
: : DateTools.Resolution.DAY))
: :      (java.util.Date) Wed Jan 11 18:00:00 CST 2006
: :
: :
: ----------------------------------------------------------------------------
: : ----
: :
: : The problem appears to be on the stringToDate conversion.
: :
: :
: ----------------------------------------------------------------------------
: : ----
: :
: : OK:
: :
: : DateTools.dateToString(new Date("01/12/2006"), DateTools.Resolution.DAY)
: :      (java.lang.String) 20060112
: :
: : NOT OK:
: :
: : DateTools.stringToDate("20060112")
: :      (java.util.Date) Wed Jan 11 18:00:00 CST 2006
: :
: :
: ----------------------------------------------------------------------------
: : ----
: :
: : I assume there is something simple I am missing, please, anybody, WHAT?
: :
: : Local time zone is GMT-0600 (CST)
: :
: : OS is Redhat E-L 4.
: :
: : jre is from Sun jdk 1.4
: :
: : Lucene is lucene-core-2.0.1.jar
: :
: : Paul Snyder
: : Web Programmer
: : Post-Bulletin Company, L.L.C.
: : Phone (507) 281-7402 Fax (507) 281-7491 TollFree (800) 562-1758
: : http://www.postbulletin.com http://www.pbinternetservices.com
: : http://www.rochestermn.com
: :
: :
: :
: : ---------------------------------------------------------------------
: : To unsubscribe, e-mail: [EMAIL PROTECTED]
: : For additional commands, e-mail: [EMAIL PROTECTED]
: :
:
:
:
: -Hoss
:
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
:
:
:
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
:



-Hoss


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

Reply via email to