--- trunk/html/swish.cgi 2003/03/16 21:59:10 18
+++ trunk/html/swish.cgi 2003/03/18 20:24:57 22
@@ -95,17 +95,24 @@
$s=~tr/¹©ðÐèÈæƾ®/sSdDcCcCzZ/;
$s=~s/\*\*+/*/g;
+ my %params; # optional parametars for swish
+
+ my @properties = split(/\s+/,x($config->{properties}));
+ $params{properties} = \@properties if (@properties);
+
my $sh = SWISH->connect('Fork',
prog => x($config->{prog}),
indexes => x($config->{index}),
-# properties => [qw/god br nr/],
results => sub {
my ($sh,$hit) = @_;
+ my $hit_fmt = x($config->{hit}) ||
+ "%s [%s]
\n";
+
if ($config->{url}) {
- printf ("%s [%s]
\n","http://".virtual_host().x($config->{url}).$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank);
+ printf ($hit_fmt ,"http://".virtual_host().x($config->{url}).$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank);
} else {
- printf ("%s [%s]
\n",$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank);
+ printf ($hit_fmt ,$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank, map($hit->$_, @properties) );
}
@@ -114,6 +121,7 @@
# print "Field '$_' = '", $hit->$_, "'
\n" for sort @fields;
},
maxhits => param('max_hits') || $max_hits,
+ \%params,
);
die $SWISH::errstr unless $sh;