Re: [htdig] [Q]: Hacking source, advice please (adding search date


Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Fri, 26 Feb 1999 16:22:08 -0600 (CST)


According to Geoff Hutchison:
> On Fri, 26 Feb 1999, mike grommet wrote:
> > and of course making sure its in the time_t format, I'm really not quite
> > sure where I need to place the check for acceptance and recjection based on
> > the time issue...
> >
> > Any ideas here?
>
> Well if you know how to get it into a time_t, I'll be glad to code the
> accept/reject code myself and post a full patch. I thought the hard part
> was converting it into a time_t, since you don't know what the format is!
> Maybe you've decided to restrcit the format?

I can think of about 3 ways of doing it.

1) use code like in htdig/Document.cc's getdate() function. That
restricts the format to dd Mmm yyyy hh:mm:ss, which is probably too
restrictive, especially as the user is probably only concerned about
the date, and not the time.

2) use code like in htnotify/htnotify.cc's parse_date() function. You'd
then need to decrement the month and adjust the year like htnotify does,
but instead of comparing against a tm structure, you can plug the day,
month & year into a tm structure, add in a dummy hour, min & sec (e.g.
midnight), and pass it to timegm or mytimegm (like getdate() does)
to get a time_t.

3) use GNU getdate(). I'm not really familiar with that function,
but it'd probably give you the most flexibility in terms of date format
(though parse_date() is pretty flexible as long as you stick to numeric
months).

Remember to take timezones into consideration. HTTP servers return dates
in UTC, and if your CGI scripts return Last-Modified headers, those too
should be in UTC. However, htsearch displays the dates of matched documents
using the localtime() function, which would likely use the search machine's
timezone, if the HTTP server on that machine is aware of its timezone.
This can affect the date. E.g. a document modified at 24 Feb 1999 21:00 EST
will have a UTC date of 25 Feb 1999 02:00. Take that into account in your
user interface. My guess is the users would want to specify the date in
the local timezone.

As for where to place the check for rejection, my guess would be
Display::buildMatchList(), in the part where thisRef is processed.
That way, htsearch only needs to fetch the docdb record once for each
match. If thisRef->DocTime() is out of range, then the code can just
delete thisRef and thisMatch, then continue, and the match won't get
added to the list.

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Fri Feb 26 1999 - 14:34:13 PST