According to William R. Knox:
> I am still seeing this problem, and have come across another clue. It
> works fine if a relative endday, such as -1, is also passed. In reading
> the bugs database closer, it also appears that bug 578570 may also be
> related.
> 
> I have confirmed this bug by searching on the htdig site with the
> following three GET strings sent via a telnet session - note how the final
> two hit counts differ:
> 
> Search for 'startday', no date range (returns 50 hits)
> ---
> GET /cgi-bin/htsearch?method=and&words=startday HTTP/1.1
> Host: www.htdig.org
> 
> Search for 'startday', set startday to -60 (returns 0 hits)
> ---
> GET /cgi-bin/htsearch?method=and&words=startday&startday=-60 HTTP/1.1
> Host: www.htdig.org
> 
> Search for 'startday', set startday to -60 and endday to -1 (returns 1 hit)
> ---
> GET /cgi-bin/htsearch?method=and&words=startday&startday=-60&endday=-1 HTTP/1.1
> Host: www.htdig.org
> 
> Unfortunately, my C++ coding is non-existent, but the line which seems to
> me to be suspect is in Display.cc, line 1295-6:
>     else if (!reldate)
>         enddate.tm_year = endoftime->tm_year;
> 
> Could this somehow be getting set to the same year as the
> startdate.tm_year?

... and on Tue, 7 Jan 2003 ...
> I believe that I have come across a bug in the startday code in version
> 3.1.6 (I have applied the metadate.0 patch and the timet_enddate.1 patch).
> Briefly, using a negative number in the startday that overlaps a year
> boundary (i.e. using a number greater than -7 today, 1/7/03) causes only
> entries for the previous year to be displayed. Here is an example:

Whoops!  Mea culpa.  When I added the support for relative dates, I
didn't realize that the added localtime() calls would clobber the data
structure that endoftime is set to point to.  Surprisingly, this doesn't
affect all systems, but I guess some implementations of localtime share
the same return data structure as gmtime, and some don't.

Here's a fix, which I'll call timet_enddate.2, and which overrides
the timet_enddate.1 patch in the archives.  It saves a copy of the
gmtime return structure so it's not clobbered.  Plus it includes
Robert Marchand's earlier fix for the problem in 3.1.6's handling of
the end date in the date range support.  (The test to see if the end
date was set was wrong, so htsearch assumed it always had to check
the date for each match, which caused the extra overhead described in
http://www.htdig.org/FAQ.html#q5.10)

Apply this patch in your main htdig-3.1.6 source directory using the
command:  patch -p0 < this-message-file

If you've already applied timet_enddate.1, don't worry: the second hunk
of this patch will fail (because it's already been applied), but the
first should apply fine and all should work fine after that.

--- htsearch/Display.cc.orig    Thu Jan 31 17:47:18 2002
+++ htsearch/Display.cc Tue Jan 21 15:46:19 2003
@@ -1148,6 +1148,8 @@ Display::buildMatchList()
 
     // find the end of time
     endoftime = gmtime(&eternity);
+    tm eterni_tm = *endoftime;
+    endoftime = &eterni_tm;
 
     if(dategiven)    // user specified some sort of date information
       {
@@ -1407,7 +1409,7 @@ Display::buildMatchList()
 
        // New check added on whether or not we need to check date ranges - MG
        if (date_factor != 0.0 || backlink_factor != 0.0 || typ != SortByScore
-           || timet_startdate > 0 || enddate.tm_year < endoftime->tm_year)
+           || timet_startdate > 0 || timet_enddate < eternity)
          {
            DocumentRef *thisRef = docDB.FindCoded(thisMatch->getURL());
            if (thisRef)   // We better hope it's not null!

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/
Dept. Physiology, U. of Manitoba  Winnipeg, MB  R3E 3J7  (Canada)


-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to