From owner-freebsd-doc Wed Oct 22 10:46:02 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id KAA14474 for doc-outgoing; Wed, 22 Oct 1997 10:46:02 -0700 (PDT) (envelope-from owner-freebsd-doc) Received: from mail.cs.tu-berlin.de (root@mail.cs.tu-berlin.de [130.149.17.13]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id KAA14381 for ; Wed, 22 Oct 1997 10:44:35 -0700 (PDT) (envelope-from wosch@cs.tu-berlin.de) Received: from caramba.cs.tu-berlin.de (wosch@caramba.cs.tu-berlin.de [130.149.17.12]) by mail.cs.tu-berlin.de (8.8.6/8.8.7) with ESMTP id TAA22791; Wed, 22 Oct 1997 19:37:27 +0200 (MET DST) From: Wolfram Schneider Received: (from wosch@localhost) by caramba.cs.tu-berlin.de (8.8.6/8.8.6) id TAA25347; Wed, 22 Oct 1997 19:37:21 +0200 (MET DST) Date: Wed, 22 Oct 1997 19:37:21 +0200 (MET DST) Message-Id: <199710221737.TAA25347@caramba.cs.tu-berlin.de> To: docs@freebsd.org Subject: Mailing list search sorted by date MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-doc@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The patch sort the result of a mailing list search by date instead by score. See http://www.freebsd.org/~wosch/test/www/data/search.html (this URL has a very short lifetime) --- /home/w/wosch/bsd/FreeBSD/FreeBSD-current/www/data/cgi/search.cgi Tue Dec 10 11:25:00 1996 +++ search.cgi Wed Oct 22 19:16:38 1997 @@ -106,6 +106,7 @@ &open2(WAISOUT, WAISIN, $waisq, "-g"); print WAISIN $w_question; + local(@mylist) = (); local($hits, $score, $headline, $lines, $bytes, $type, $date, $file); while () { /:score\s+(\d+)/ && ($score = $1); @@ -114,8 +115,16 @@ /:number-of-bytes\s+(\d+)/ && ($bytes = $1); /:type "(.*)"/ && ($type = $1); /:headline "(.*)"/ && ($headline = $1); # XXX - /:date "(\d+)"/ && ($date = $1, $hits++, &docdone); + /:date "(\d+)"/ && ($date = $1, $hits++, + push(@mylist, join("\t", $date, $headline, $type, $bytes, $lines, $file, $score))); } + + foreach (reverse sort {$a <=> $b} @mylist) { + ($date, $headline, $type, $bytes, $lines, $file, $score) = + split("\t"); + &docdone; + } + print "\n"; print "

Didn't get what you expected? "; -- Wolfram Schneider http://www.apfel.de/~wosch/