#!/usr/bin/perl
use Search::Namazu;
my @hlists =
Search::Namazu::Search(
index => '/usr/local/namazu/index',
query => 'namazu',
sortMethod => NMZ_SORTBYSCORE,
sortOrder => NMZ_DESCENDSORT
);
if ($#hlists == 0 && !ref($hlists[0])) {
print "Error: $hlists[0]\n";
exit 1;
}
my $docs = $#hlists + 1;
print "Total $docs documents matching your query.\n\n";
my $n = 1;
foreach my $hlist (@hlists) {
next if (!defined($hlist));
my $date = localtime($hlist->date);
printf("%d. %s (score: %d)", $n, $hlist->title, $hlist->score);
printf(" (rank: %d)\n", $hlist->rank);
printf("Author: %s\n", $hlist->author);
printf("Date: %s\n", $date);
printf("%s\n", $hlist->summary);
printf("%s\n", $hlist->uri);
print "\n";
$n++;
}
|