Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 1997 19:37:21 +0200 (MET DST)
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        docs@freebsd.org
Subject:   Mailing list search sorted by date
Message-ID:  <199710221737.TAA25347@caramba.cs.tu-berlin.de>

next in thread | raw e-mail | index | archive | help

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 (<WAISOUT>) {
             /: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 "</OL>\n";
 
 	print "<p>Didn't get what you expected? ";


-- 
Wolfram Schneider    <wosch@apfel.de>    http://www.apfel.de/~wosch/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710221737.TAA25347>