32 |
|
|
33 |
# configuration for hyper estraier full text search engine |
# configuration for hyper estraier full text search engine |
34 |
hyperestraier: |
hyperestraier: |
35 |
url: 'http://localhost:1978/node/webpac2' |
url: 'http://localhost:1978/node/webpac2' |
36 |
user: 'admin' |
user: 'admin' |
37 |
passwd: 'admin' |
passwd: 'admin' |
38 |
|
|
39 |
|
webpac: |
40 |
|
db_path: '/data/webpac2/db' |
41 |
|
template_path: '/data/webpac2/conf/output/tt' |
42 |
|
template: 'html_ffzg_results_short.tt' |
43 |
|
# encoding comming from webpac |
44 |
|
webpac_encoding: 'iso-8859-2' |
45 |
|
# encoding expected by Catalyst |
46 |
|
out_encoding: 'UTF-8' |
47 |
|
|
48 |
=cut |
=cut |
49 |
|
|
80 |
|
|
81 |
$self->{template} ||= $c->config->{webpac}->{template}; |
$self->{template} ||= $c->config->{webpac}->{template}; |
82 |
|
|
83 |
|
$self->{iconv} = new Text::Iconv( |
84 |
|
$c->config->{webpac}->{webpac_encoding}, |
85 |
|
$c->config->{webpac}->{out_encoding} |
86 |
|
); |
87 |
|
|
88 |
|
$log->debug("converting encoding from webpac_encoding '" , |
89 |
|
$c->config->{webpac}->{webpac_encoding}, |
90 |
|
"' to '", |
91 |
|
$c->config->{webpac}->{out_encoding}, |
92 |
|
"'" |
93 |
|
); |
94 |
|
|
95 |
return $self; |
return $self; |
96 |
|
|
97 |
} |
} |
101 |
|
|
102 |
my $log = $self->{log}; |
my $log = $self->{log}; |
103 |
|
|
104 |
$log->debug("search got query: $query<--"); |
$log->debug("search model query: -->$query<--"); |
105 |
|
|
106 |
my $template_filename = $self->{template}; |
my $template_filename = $self->{template}; |
107 |
|
|
111 |
max => 100, |
max => 100, |
112 |
); |
); |
113 |
|
|
114 |
|
$log->debug("loading " . ($#results + 1) . " results"); |
115 |
|
|
116 |
for my $i ( 0 .. $#results ) { |
for my $i ( 0 .. $#results ) { |
117 |
|
|
118 |
my $mfn = $1 if ( $results[$i]->{'@uri'} =~ m#/(\d+)$#); |
my $mfn = $1 if ( $results[$i]->{'@uri'} =~ m#/(\d+)$#); |
119 |
|
|
120 |
$log->debug("load_ds( $mfn )"); |
# $log->debug("load_ds( $mfn )"); |
121 |
|
|
122 |
my $ds = $self->{db}->load_ds( $mfn ) || next; |
my $ds = $self->{db}->load_ds( $mfn ) || next; |
123 |
$results[$i]->{ html } = $self->{out}->apply( |
$results[$i]->{ html } = $self->{iconv}->convert( |
124 |
|
$self->{out}->apply( |
125 |
template => $template_filename, |
template => $template_filename, |
126 |
data => $ds, |
data => $ds, |
127 |
); |
) ); |
128 |
} |
} |
129 |
|
|
130 |
return \@results; |
return \@results; |