lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Aroush" <geo...@aroush.net>
Subject RE: [jira] Updated: (LUCENENET-14) Lucene.Net 1.9 implementation of StringToDate is incorrect
Date Thu, 17 Aug 2006 16:12:59 GMT
Hi Ben,

Thanks for the feedback.  You are right, the original code is the right
code.  I over looked the fact that in the Java word, ticks are as of from
"Jan 1st 1970", but in the .NET world, they are as of "Jan 1st 0001".

I just fixed this in the 2.0 release and will fix it in the 1.9 and 1.9.1
release later on today.

Regards,

-- George

-----Original Message-----
From: Ben Martz [mailto:benmartz@gmail.com] 
Sent: Thursday, August 17, 2006 10:57 AM
To: lucene-net-dev@incubator.apache.org
Subject: Re: [jira] Updated: (LUCENENET-14) Lucene.Net 1.9 implementation of
StringToDate is incorrect

>>From DateField.cs - the lines below the strange comment tagged
Aroush-1.9were commented out in the
1.9 release archive. I commented out the first line and uncommented the
following lines and conversion works correctly. I did not take the time to
actually track down the root cause however so this may not be the most
correct solution but I hope this info helps you. This is with new indexes
built using Visual Studio 2005.

Cheers,
Ben

        /// <summary>Converts a string-encoded date into a Date object.
</summary>
        public static System.DateTime StringToDate(System.String s)
        {
//            return new System.DateTime(StringToTime(s));

            // {{Aroush-1.9}} Will the line above do it or do we need the
lines below?!

            long ticks = StringToTime(s) * TimeSpan.TicksPerMillisecond;
            System.DateTime date = new System.DateTime(1970, 1, 1);
            date = date.AddTicks(ticks);
            date = date.Add(TimeZone.CurrentTimeZone.GetUtcOffset(date));
            return date;
        }


On 8/17/06, George Aroush (JIRA) <jira@apache.org> wrote:
>
>      [ http://issues.apache.org/jira/browse/LUCENENET-14?page=all ]
>
> George Aroush updated LUCENENET-14:
> -----------------------------------
>
>
> Hi,
>
> Are you sure that this is not due changes in the way dates are stored 
> in 1.4.x vs. 1.9.x?
>
> Have you tried the same test with an index created by 1.9?  Did you 
> see the same problem?
>
> If the answer is "yes" to both of those questions, please provide a 
> sample code to recreate the issue.
>
> Thanks.
>
> -- George Aroush
>
> > Lucene.Net 1.9 implementation of StringToDate is incorrect
> > ----------------------------------------------------------
> >
> >                 Key: LUCENENET-14
> >                 URL: http://issues.apache.org/jira/browse/LUCENENET-14
> >             Project: Lucene.Net
> >          Issue Type: Bug
> >            Reporter: Piotr Dobrowolski
> >         Assigned To: George Aroush
> >
> > Current implementation is incorrect. It returns dates like:
> > 0001-01-01.
> > Old implementation works fine.
> > I have just removed 13 millions of documents from my index based on
> dates returned from this function :((
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
> http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see: 
> http://www.atlassian.com/software/jira
>
>
>


--
Mmmmmm...C8H11NO2


Mime
View raw message