Re: htdig: Sorting results on date


Geoff Hutchison (ghutchis@wso.williams.edu)
Fri, 11 Dec 1998 00:24:48 -0500


Gilles approach is the way I'd go. I guess I'd pick a name, either "sort"
or "sortby" or something like that and then pick the values that would be
useful, like score, date, title, size. Then I'd just expand the compare
method as he said. One thing to remember is that in the general case, you
might not have a valid date because some servers screw up. If you
implemented a title sort, you'd also need to worry about documents without
titles.

At 11:46 AM -0500 12/8/98, Gilles Detillieux wrote:
>Note: this would break Display::display(). It assumes the first score of
>the first item in the match list is the highest score, which is only true
>if the list is sorted by score. You don't want to mess up the scores, as
>they're used to show the ranks of the matches (i.e. number of stars). So,
>instead of grabbing the first score, you'd have to go through the whole
>list and find the highest score.

You can get the highest score as you do the sort. Just make sure you keep
track of the higest score as you go through the sort. The display method
just needs to know what the max is, it doesn't care which document has the
max.

-Geoff Hutchison
Williams Students Online
http://wso.williams.edu/

----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.



This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:29:50 PST