%# -*-perl-*- $Id: search.html,v 1.12 2000/11/07 20:14:21 xi Exp $ <%doc> ############################################################################### # Usenet Indexer - A nice and fast usenet indexer # Copyright (C) 2000 Christian Laursen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################### <% $r->hostname %>

Search results

You searched for: <% $search %>
<%perl> my $buffer; my $searchtime; local *FILE; if (open (FILE, "<$resfile") && (stat($resfile))[7]) { read (FILE, $buffer, 16); my ($secs1,$usecs1,$secs2,$usecs2) = unpack("LLLL", $buffer); my $secs = $secs2 - $secs1; my $usecs = $usecs2 - $usecs1; if ($usecs < 0) { $secs--; $usecs += 1000000; } $searchtime = sprintf ("%d.%06d", $secs, $usecs); Found <% ((stat($resfile))[7]-16) / 8 %> results (showing from <% $offset %>) (Search took <% $searchtime %> seconds) %if (((stat($resfile))[7]-16) / 8 == 500) { (WARNING: Your search was not specific enough - results may be unreliable) %} <%perl> if ($offset =~ /^\d+$/) { seek (FILE, $offset * 8 + 16, 0); } my $i = 0; my $show = 25; while (read (FILE, $buffer, 8) && $i++ < $show) { my ($id,$hits) = unpack("II", $buffer); my $hfile = sprintf("../data/article/%08x.headers", $id); my ($from, $subject); open (FILE2, "<$hfile") or die "Couldn't read file: $!"; while () { if (m/^From: (.*)$/) { $from = $1; } elsif (m/^Subject: (.*)$/) { $subject = $1; } } close FILE2; $m->out("". "\n"); } $m->out("
FromSubjectScore 
$from$subject$hitsShow thread
\n"); if ($offset != 0) { $m->out("[Previous] "); } if ($i > $show && read (FILE, $buffer, 8)) { $m->out("[Next]"); } close FILE;
<%perl> } else { $m->out("No results found."); } <%args> $search => '' @groups => () $maxage => 0 $offset => 0 <%init> &deja_init; my $resfile = search(\$search, \@groups, $maxage);