92 |
$log->info("using encoding $encoding"); |
$log->info("using encoding $encoding"); |
93 |
|
|
94 |
$self->{'iconv'} = new Text::Iconv($encoding, 'UTF-8') or |
$self->{'iconv'} = new Text::Iconv($encoding, 'UTF-8') or |
95 |
$log->die("can't create conversion from $encoding to UTF-8"); |
$log->logdie("can't create conversion from $encoding to UTF-8"); |
96 |
|
|
97 |
$self ? return $self : return undef; |
$self ? return $self : return undef; |
98 |
} |
} |
160 |
$log->logconfess("no values for $tag/$type") unless ($vals); |
$log->logconfess("no values for $tag/$type") unless ($vals); |
161 |
|
|
162 |
$vals = $self->{'iconv'}->convert( $vals ) or |
$vals = $self->{'iconv'}->convert( $vals ) or |
163 |
$log->die("can't convert '$vals' to UTF-8"); |
$log->logdie("can't convert '$vals' to UTF-8"); |
164 |
|
|
165 |
$doc->add_attr( $tag, $vals ); |
$doc->add_attr( $tag, $vals ); |
166 |
$doc->add_hidden_text( $vals ); |
$doc->add_hidden_text( $vals ); |
169 |
my $text = $args->{'text'}; |
my $text = $args->{'text'}; |
170 |
if ( $text ) { |
if ( $text ) { |
171 |
$text = $self->{'iconv'}->convert( $text ) or |
$text = $self->{'iconv'}->convert( $text ) or |
172 |
$log->die("can't convert '$text' to UTF-8"); |
$log->logdie("can't convert '$text' to UTF-8"); |
173 |
$doc->add_text( $text ); |
$doc->add_text( $text ); |
174 |
} |
} |
175 |
|
|
176 |
$log->debug("adding ", sub { $doc->dump_draft } ); |
$log->debug("adding ", sub { $doc->dump_draft } ); |
177 |
$self->{'db'}->put_doc($doc) || $log->die("can't add document $uri to index"); |
$self->{'db'}->put_doc($doc) || $log->logdie("can't add document $uri to index"); |
178 |
|
|
179 |
return 1; |
return 1; |
180 |
} |
} |