--- trunk/make_config.pl 2003/05/04 01:31:31 33 +++ trunk/make_config.pl 2003/11/19 12:07:07 45 @@ -6,13 +6,18 @@ # use strict; +use Getopt::Long; + +my $stripurl; + +my $result = GetOptions ("stripurl=s" => \$stripurl); my $name = shift @ARGV; my $url = shift @ARGV; -my $stripurl = shift @ARGV; +my $title = join(" ",@ARGV); if (!$name || !$url) { - print "Usage: $0 name URL [strip from url]\n"; + print "Usage: $0 [--stripurl=path] name URL title\n"; exit; } @@ -27,10 +32,10 @@ if ($url =~ m#(http://[^/]+)(/.*)$#) { ($host,$urlpath) = ($1,$2); - if ($stripurl && $urlpath =~ m/^(.*$stripurl)/) { + if ($stripurl && $url =~ m/^(.*$stripurl)/) { $stripurl = $1; } else { - $stripurl = ""; + $stripurl = $host; } } else { print "Can't parse URL $url into host and path!\n"; @@ -41,6 +46,7 @@ $baseurl =~ s#/[^/]+$#/#g; print "Config name: $name\nCrawling url: $url [strip $stripurl]\n"; +print "Title: $title\n" if ($title); my $config = <<"EOF"; @@ -49,9 +55,9 @@ IncludeConfigFile $dir/common.config # this is a cludge to implement no parent URL feature in swish indexer -IndexDir "$url $baseurl" -ReplaceRules replace " $baseurl" "" -ReplaceRules replace "${host}${stripurl}" "" +IndexDir "$baseurl $url" +ReplaceRules replace "$baseurl " "" +ReplaceRules replace "${stripurl}" "" IndexFile $dir/index/$name @@ -71,9 +77,23 @@ prog="/usr/bin/swish-e" index="$dir/index/$name" charset="iso-8859-2" - title="$name search" affix="/usr/lib/ispell/american.aff" - url="$stripurl" +EOF +if ($title) { + $xml .= "\ttitle=\"$title\"\n"; +} else { + $xml .= "\ttitle=\"$name search\"\n"; +} + +my $xml_title = $title || $url; + +my $xml_url = $url; +$xml_url =~ s/^$host//; +my $xml_urlprefix = $stripurl; +$xml_urlprefix =~ s/^$host//; + +$xml .= "\turl=\"$xml_urlprefix\"\n" if ($stripurl); +$xml .= << "EOF"; > @@ -88,7 +108,15 @@ don't display results details Showing %s documents (of maximum %d)... (%s) Can't find any documents (%s, %s) - + swishdescription swishdocsize