--- trunk/make_config.pl 2003/05/04 01:31:31 33 +++ trunk/make_config.pl 2004/01/26 08:08:41 59 @@ -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 @@ -67,18 +73,32 @@ my $xml = << "EOF"; + - Search for @@ -88,7 +108,15 @@ don't display results details Showing %s documents (of maximum %d)... (%s) Can't find any documents (%s, %s) -
Searcher will try to create different variations of words using spelling dictionary. If you enter a word with minus (-) before it, it will exclude documents with this word and plus (+) will do the opposite (e.g. -work +play)
+
-) before it, it will exclude documents with this + word and plus (+) will do the opposite + (e.g. -work +play) +

Content indexed: + $xml_title

+ ]]>
swishdescription swishdocsize @@ -99,8 +127,8 @@
EOF -print "Creating $dir/$name.config\n"; -open(C,"> $dir/$name.config") || die "can't open $dir/$name.config: $!"; +print "Creating $dir/config/$name\n"; +open(C,"> $dir/config/$name") || die "can't open $dir/config/$name: $!"; print C $config; close(C); @@ -112,5 +140,5 @@ print "Creating symlink to $dir/html/$name.cgi\n"; symlink "$dir/html/swish.cgi","$dir/html/$name.cgi" || die "can't create symlink $dir/html/$name.cgi: $!"; -#print "Index this with:\nswish-e -S http -c $dir/$name.config\n"; +#print "Index this with:\nswish-e -S http -c $dir/config/$name\n"; #print "Search using $name.cgi\n";