--- trunk/html/swish.cgi 2003/03/18 20:20:11 21
+++ trunk/html/swish.cgi 2003/03/21 22:01:59 27
@@ -41,6 +41,14 @@
$labels{$_->{value}} = x($_->{content});
}
+my $path = param('path'); # limit to this path
+my %path_label;
+my @path_name;
+foreach (@{$config->{paths}->{path}}) {
+ push @path_name,x($_->{limit});
+ $path_label{$_->{limit}} = x($_->{content});
+}
+
if ($config->{charset}) {
print header(-charset=>x($config->{charset}));
} else {
@@ -53,6 +61,10 @@
print textfield('search');
print submit(-value=> x($config->{text}->{submit}));
print checkbox(-name=>'no_affix', -checked=>0, -label=>x($config->{text}->{no_spell})) if ($spelling_alt);
+if (@path_name) {
+ print br,x($config->{text}->{limit});
+ print popup_menu(-name=>'path',-values=>\@path_name,-labels=>\%path_label,-default=>$path);
+}
print end_form,hr;
if (param('search')) {
@@ -95,12 +107,17 @@
$s=~tr/¹©ðÐèÈæƾ®/sSdDcCcCzZ/;
$s=~s/\*\*+/*/g;
+ # limit to some path
+ $s = "swishdocpath=(\"$path\") and $s" if ($path);
+
+ 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 => \@properties,
results => sub {
my ($sh,$hit) = @_;
@@ -119,6 +136,7 @@
# print "Field '$_' = '", $hit->$_, "'
\n" for sort @fields;
},
maxhits => param('max_hits') || $max_hits,
+ \%params,
);
die $SWISH::errstr unless $sh;