150 |
} |
} |
151 |
} |
} |
152 |
|
|
153 |
|
sub init_visible_type($) { |
154 |
|
my $type = shift; |
155 |
|
|
156 |
|
# swish, swish_exact, display, index, index_lookup |
157 |
|
# swish and display defaults |
158 |
|
my ($s,$se,$d,$i,$il) = (1,0,1,0,0); |
159 |
|
if (lc($type) eq "display") { |
160 |
|
$s = 0; |
161 |
|
} elsif (lc($type) eq "swish") { |
162 |
|
$d = 0; |
163 |
|
} elsif (lc($type) eq "index") { |
164 |
|
($s,$se,$d,$i) = (0,1,0,1); |
165 |
|
} elsif (lc($type) eq "swish_exact") { |
166 |
|
($s,$se,$d,$i) = (0,1,0,0); |
167 |
|
} elsif (lc($type) =~ /^lookup/) { |
168 |
|
($s,$se,$d,$i,$il) = (0,1,0,0,1); |
169 |
|
} |
170 |
|
return ($s,$se,$d,$i,$il); |
171 |
|
} |
172 |
|
|
173 |
# begin real work: go field by field |
# begin real work: go field by field |
174 |
foreach my $field (@sorted_tags) { |
foreach my $field (@sorted_tags) { |
208 |
|
|
209 |
my $repeat_off = 0; # init repeatable offset |
my $repeat_off = 0; # init repeatable offset |
210 |
|
|
211 |
# swish, swish_exact, display, index, index_lookup |
my ($s,$se,$d,$i,$il) = init_visible_type($x->{type}); |
|
# swish and display defaults |
|
|
my ($s,$se,$d,$i,$il) = (1,0,1,0,0); |
|
|
$s = 0 if (lc($x->{type}) eq "display"); |
|
|
$d = 0 if (lc($x->{type}) eq "swish"); |
|
|
($s,$se,$d,$i) = (0,1,0,1) if (lc($x->{type}) eq "index"); |
|
|
($s,$se,$d,$i) = (0,1,0,0) if (lc($x->{type}) eq "swish_exact"); |
|
|
($s,$se,$d,$i,$il) = (0,1,0,0,1) if (lc($x->{type}) =~ /^lookup/); |
|
212 |
|
|
213 |
# what will separate last line from this one? |
# what will separate last line from this one? |
214 |
if ($display_data && $x->{append}) { |
if ($display_data && $x->{append}) { |
432 |
my $delimiter = x($x->{delimiter}) || ' '; |
my $delimiter = x($x->{delimiter}) || ' '; |
433 |
my $val = $cfg->val($database, x($x->{content})); |
my $val = $cfg->val($database, x($x->{content})); |
434 |
|
|
435 |
my ($s,$d,$i) = (1,1,0); # swish, display default |
# FIXME index_lookup is not supported! |
436 |
$s = 0 if (lc($x->{type}) eq "display"); |
my ($s,$se,$d,$i,$il) = init_visible_type($x->{type}); |
|
$d = 0 if (lc($x->{type}) eq "swish"); |
|
|
# no support for swish exact in config. |
|
|
# IMHO, it's useless |
|
|
($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index"); |
|
437 |
|
|
438 |
if ($val) { |
if ($val) { |
439 |
$display_data .= $delimiter.$val if ($d); |
$display_data .= $delimiter.$val if ($d); |
440 |
$swish_data .= $val if ($s); |
$swish_data .= " ".$val if ($s); |
441 |
$index->insert($field, $val, $path) if ($i); |
$index->insert($field, $val, $path) if ($i); |
442 |
} |
} |
443 |
|
|