78 |
($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index"); |
($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index"); |
79 |
#print STDERR "## s: $s d: $d i: $i ## $format ##\n"; |
#print STDERR "## s: $s d: $d i: $i ## $format ##\n"; |
80 |
|
|
81 |
|
# FIX: this is ugly, UGLY, cludge string is returned |
82 |
|
# in UTF8 encoding , but as if source charset |
83 |
|
# is ISO8859-1 and not some other. This break other |
84 |
|
# character encodings, so we convert it first |
85 |
|
# back to ISO8859-1 |
86 |
$format = $cludge_codepage->convert($format); |
$format = $cludge_codepage->convert($format); |
87 |
|
|
88 |
my ($swish,$display) = parse_format($format,$row); |
my ($swish,$display) = parse_format($format,$row); |
89 |
#print STDERR "s: $swish\nd: $display\n" if ($swish); |
#print STDERR "s: $swish\nd: $display\n" if ($swish); |
90 |
|
|
91 |
#print STDERR "swish: $swish<-- display: $display<--\n"; |
#print STDERR "swish: $swish<-- display: $display<--\n"; |
|
# FIX: this is ugly, UGLY, cludge: OpenIsis return |
|
|
# UTF8 encoding of strings, but as if source charset |
|
|
# is ISO8859-1 and not some other. This breaks our |
|
|
# isis character encoding, so we convert it first |
|
|
# back to ISO8859-1 (which can actually be different |
|
|
# encoding in isis) |
|
92 |
|
|
93 |
$swish_data .= $swish if ($s && $swish); |
# filter="name" ; filter this field through |
94 |
$display_data .= $display if ($d && $display); |
# filter/[name].pm |
95 |
|
my $filter; |
96 |
|
if ($x->{filter}) { |
97 |
|
$filter = "filter/".$x->{filter}.".pm"; |
98 |
|
require $filter; |
99 |
|
} |
100 |
|
# type="swish" ; field for swish |
101 |
|
if ($s && $swish) { |
102 |
|
if ($filter) { |
103 |
|
$swish_data .= join(" ",&filter($swish)); |
104 |
|
} else { |
105 |
|
$swish_data .= $swish if ($s && $swish); |
106 |
|
} |
107 |
|
} |
108 |
|
|
109 |
# insert into index |
# type="display" ; field for display |
110 |
|
if ($d && $display) { |
111 |
|
if ($filter) { |
112 |
|
$display_data .= join(" ",&filter($display)); |
113 |
|
} else { |
114 |
|
$display_data .= $display; |
115 |
|
} |
116 |
|
} |
117 |
|
|
118 |
|
# type="index" ; insert into index |
119 |
if ($i && $display) { |
if ($i && $display) { |
120 |
my $index_data = $index_codepage->convert($display) || $display; |
my $index_data = $index_codepage->convert($display) || $display; |
121 |
$index->insert($field, $index_data, $db_dir); |
if ($filter) { |
122 |
|
foreach my $d (&filter($index_data)) { |
123 |
|
$index->insert($field, $d, $db_dir); |
124 |
|
} |
125 |
|
} else { |
126 |
|
$index->insert($field, $index_data, $db_dir); |
127 |
|
} |
128 |
} |
} |
129 |
} |
} |
130 |
|
|
145 |
$field_name = $config->{indexer}->{$field}->{name_singular}."#-#"; |
$field_name = $config->{indexer}->{$field}->{name_singular}."#-#"; |
146 |
} elsif ($config->{indexer}->{$field}->{name_plural}) { |
} elsif ($config->{indexer}->{$field}->{name_plural}) { |
147 |
$field_name = $config->{indexer}->{$field}->{name_plural}."#-#"; |
$field_name = $config->{indexer}->{$field}->{name_plural}."#-#"; |
148 |
} else { |
} elsif ($config->{indexer}->{$field}->{name}) { |
149 |
$field_name = $config->{indexer}->{$field}->{name}."#-#"; |
$field_name = $config->{indexer}->{$field}->{name}."#-#"; |
150 |
|
} else { |
151 |
|
print STDERR "WARNING: field '$field' doesn't have 'name' attribute!"; |
152 |
} |
} |
153 |
if ($field_name) { |
if ($field_name) { |
154 |
$html .= $xml_codepage->convert($field_name); |
$html .= $xml_codepage->convert($field_name); |
158 |
} |
} |
159 |
if ($swish_data) { |
if ($swish_data) { |
160 |
my $i = Text::Iconv->new($config->{isis_codepage},'ISO8859-2'); |
my $i = Text::Iconv->new($config->{isis_codepage},'ISO8859-2'); |
161 |
|
# remove extra spaces |
162 |
|
$swish_data =~ s/ +/ /g; |
163 |
|
$swish_data =~ s/ +$//g; |
164 |
|
|
165 |
$swish_data = $i->convert($swish_data); |
$swish_data = $i->convert($swish_data); |
166 |
$xml .= xmlify($field."_swish",unac_string('ISO8859-2',$swish_data)); |
$xml .= xmlify($field."_swish",unac_string('ISO8859-2',$swish_data)); |
167 |
#$swish_data = $isis_codepage->convert($swish_data)."##" || $swish_data; |
#$swish_data = $isis_codepage->convert($swish_data)."##" || $swish_data; |