7 |
|
|
8 |
use strict; |
use strict; |
9 |
|
|
10 |
my ($name,$url,$stripurl) = @ARGV; |
my $name = shift @ARGV; |
11 |
|
my $url = shift @ARGV; |
12 |
|
#my $stripurl = shift @ARGV; |
13 |
|
my $stripurl; |
14 |
|
my $title = join(" ",@ARGV); |
15 |
|
|
16 |
if (!$name || !$url) { |
if (!$name || !$url) { |
17 |
print "Usage: $0 name URL\n"; |
print "Usage: $0 name URL [strip from url] [optional title]\n"; |
18 |
exit; |
exit; |
19 |
} |
} |
20 |
|
|
27 |
|
|
28 |
my ($host,$urlpath); |
my ($host,$urlpath); |
29 |
|
|
30 |
if ($url =~ m#(http://[^/]+)(/.+)$#) { |
if ($url =~ m#(http://[^/]+)(/.*)$#) { |
31 |
($host,$urlpath) = ($1,$2); |
($host,$urlpath) = ($1,$2); |
32 |
if ($stripurl && $urlpath =~ m/^(.*$stripurl)/) { |
if ($stripurl && $urlpath =~ m/^(.*$stripurl)/) { |
33 |
$stripurl = $1; |
$stripurl = $1; |
43 |
$baseurl =~ s#/[^/]+$#/#g; |
$baseurl =~ s#/[^/]+$#/#g; |
44 |
|
|
45 |
print "Config name: $name\nCrawling url: $url [strip $stripurl]\n"; |
print "Config name: $name\nCrawling url: $url [strip $stripurl]\n"; |
46 |
|
print "Title: $title\n" if ($title); |
47 |
|
|
48 |
|
|
49 |
my $config = <<"EOF"; |
my $config = <<"EOF"; |
52 |
IncludeConfigFile $dir/common.config |
IncludeConfigFile $dir/common.config |
53 |
|
|
54 |
# this is a cludge to implement no parent URL feature in swish indexer |
# this is a cludge to implement no parent URL feature in swish indexer |
55 |
IndexDir "$url $baseurl" |
IndexDir "$baseurl $url" |
56 |
ReplaceRules replace " $baseurl" "" |
ReplaceRules replace "$baseurl " "" |
57 |
ReplaceRules replace "${host}${stripurl}" "" |
ReplaceRules replace "${host}${stripurl}" "" |
58 |
|
|
59 |
IndexFile $dir/index/$name |
IndexFile $dir/index/$name |
74 |
prog="/usr/bin/swish-e" |
prog="/usr/bin/swish-e" |
75 |
index="$dir/index/$name" |
index="$dir/index/$name" |
76 |
charset="iso-8859-2" |
charset="iso-8859-2" |
|
title="$name search" |
|
77 |
affix="/usr/lib/ispell/american.aff" |
affix="/usr/lib/ispell/american.aff" |
78 |
url="$stripurl" |
EOF |
79 |
|
if ($title) { |
80 |
|
$xml .= "\ttitle=\"$title\"\n"; |
81 |
|
} else { |
82 |
|
$xml .= "\ttitle=\"$name search\"\n"; |
83 |
|
} |
84 |
|
$xml .= "\turl=\"$stripurl\"\n" if ($stripurl); |
85 |
|
$xml .= << "EOF"; |
86 |
> |
> |
87 |
<labels> |
<labels> |
88 |
<label value="10"> 10</label> |
<label value="10"> 10</label> |