48 |
print STDERR "swish search: $s\n"; |
print STDERR "swish search: $s\n"; |
49 |
my $results = $index->Query($s); |
my $results = $index->Query($s); |
50 |
|
|
51 |
|
# store total number of hits |
52 |
|
$self->{'total_hits'} = $results->Hits; |
53 |
|
|
54 |
my @res_ids; |
my @res_ids; |
55 |
|
|
56 |
|
my $count = 0; |
57 |
|
|
58 |
while ( my $r = $results->NextResult ) { |
while ( my $r = $results->NextResult ) { |
59 |
|
|
60 |
sub p($$) { |
sub p($$) { |
77 |
|
|
78 |
# this is redundant, but needed for templates later... |
# this is redundant, but needed for templates later... |
79 |
$self->{cache}->{$id}->{'id'} = $id; |
$self->{cache}->{$id}->{'id'} = $id; |
80 |
|
|
81 |
|
last if ($count++ > $self->{max_results}); |
82 |
} |
} |
83 |
|
|
84 |
return @res_ids; |
return @res_ids; |
95 |
my $xml = qq{<message>}; |
my $xml = qq{<message>}; |
96 |
foreach my $tag (keys %$document) { |
foreach my $tag (keys %$document) { |
97 |
my $data = $document->{$tag}; |
my $data = $document->{$tag}; |
98 |
|
next if (! $data || $data eq ''); |
99 |
# save [cr/]lf before conversion to XML |
# save [cr/]lf before conversion to XML |
100 |
$data =~ s/\n\r/##lf##/gs; |
$data =~ s/\n\r/##lf##/gs; |
101 |
$data =~ s/\n/##lf##/gs; |
$data =~ s/\n/##lf##/gs; |
102 |
$xml .= "<$tag><![CDATA[".$data."]]></$tag>\n" if ($data && $data ne ''); |
$xml .= "<$tag><![CDATA[".$data."]]></$tag>\n"; |
103 |
} |
} |
104 |
$xml .= qq{</message>}; |
$xml .= qq{</message>}; |
105 |
|
|