6 |
# |
# |
7 |
|
|
8 |
use strict; |
use strict; |
9 |
|
use Getopt::Long; |
10 |
|
|
11 |
|
my $stripurl; |
12 |
|
|
13 |
|
my $result = GetOptions ("stripurl=s" => \$stripurl); |
14 |
|
|
15 |
my $name = shift @ARGV; |
my $name = shift @ARGV; |
16 |
my $url = shift @ARGV; |
my $url = shift @ARGV; |
|
#my $stripurl = shift @ARGV; |
|
|
my $stripurl; |
|
17 |
my $title = join(" ",@ARGV); |
my $title = join(" ",@ARGV); |
18 |
|
|
19 |
if (!$name || !$url) { |
if (!$name || !$url) { |
20 |
print "Usage: $0 name URL [strip from url] [optional title]\n"; |
print "Usage: $0 [--stripurl=path] name URL title\n"; |
21 |
exit; |
exit; |
22 |
} |
} |
23 |
|
|
32 |
|
|
33 |
if ($url =~ m#(http://[^/]+)(/.*)$#) { |
if ($url =~ m#(http://[^/]+)(/.*)$#) { |
34 |
($host,$urlpath) = ($1,$2); |
($host,$urlpath) = ($1,$2); |
35 |
if ($stripurl && $urlpath =~ m/^(.*$stripurl)/) { |
if ($stripurl && $url =~ m/^(.*$stripurl)/) { |
36 |
$stripurl = $1; |
$stripurl = $1; |
37 |
} else { |
} else { |
38 |
$stripurl = ""; |
$stripurl = $host; |
39 |
} |
} |
40 |
} else { |
} else { |
41 |
print "Can't parse URL $url into host and path!\n"; |
print "Can't parse URL $url into host and path!\n"; |
57 |
# 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 |
58 |
IndexDir "$baseurl $url" |
IndexDir "$baseurl $url" |
59 |
ReplaceRules replace "$baseurl " "" |
ReplaceRules replace "$baseurl " "" |
60 |
ReplaceRules replace "${host}${stripurl}" "" |
ReplaceRules replace "${stripurl}" "" |
61 |
|
|
62 |
IndexFile $dir/index/$name |
IndexFile $dir/index/$name |
63 |
|
|
84 |
} else { |
} else { |
85 |
$xml .= "\ttitle=\"$name search\"\n"; |
$xml .= "\ttitle=\"$name search\"\n"; |
86 |
} |
} |
87 |
$xml .= "\turl=\"$stripurl\"\n" if ($stripurl); |
|
88 |
|
my $xml_title = $title || $url; |
89 |
|
|
90 |
|
my $xml_url = $url; |
91 |
|
$xml_url =~ s/^$host//; |
92 |
|
my $xml_urlprefix = $stripurl; |
93 |
|
$xml_urlprefix =~ s/^$host//; |
94 |
|
|
95 |
|
$xml .= "\turl=\"$xml_urlprefix\"\n" if ($stripurl); |
96 |
$xml .= << "EOF"; |
$xml .= << "EOF"; |
97 |
> |
> |
98 |
<labels> |
<labels> |
108 |
<no_properties>don't display results details</no_properties> |
<no_properties>don't display results details</no_properties> |
109 |
<hits>Showing %s documents (of maximum %d)... (%s)</hits> |
<hits>Showing %s documents (of maximum %d)... (%s)</hits> |
110 |
<no_hits>Can't find any documents (%s, %s)</no_hits> |
<no_hits>Can't find any documents (%s, %s)</no_hits> |
111 |
<footer>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)</footer> |
<footer><![CDATA[ |
112 |
|
Searcher will try to create different variations of words |
113 |
|
using spelling dictionary. If you enter a word with minus |
114 |
|
(<tt>-</tt>) before it, it will exclude documents with this |
115 |
|
word and plus (<tt>+</tt>) will do the opposite |
116 |
|
(e.g. <tt>-work +play</tt>) |
117 |
|
<p><small>Content indexed: |
118 |
|
<a href="$xml_url">$xml_title</small></p> |
119 |
|
]]></footer> |
120 |
</text> |
</text> |
121 |
<!-- additional data to show summary --> |
<!-- additional data to show summary --> |
122 |
<properties>swishdescription swishdocsize</properties> |
<properties>swishdescription swishdocsize</properties> |