|
Lines 194-201
sub _search {
Link Here
|
| 194 |
my $self = shift; |
194 |
my $self = shift; |
| 195 |
my $index = shift || undef; |
195 |
my $index = shift || undef; |
| 196 |
my $skipmetadata = shift || undef; |
196 |
my $skipmetadata = shift || undef; |
| 197 |
my $ind2 = $self->{field}->{_ind2}; |
197 |
my $ind2 = $self->{field}->indicator('2'); |
| 198 |
my $subject_heading_thesaurus = ''; |
|
|
| 199 |
my @marclist; |
198 |
my @marclist; |
| 200 |
my @and_or; |
199 |
my @and_or; |
| 201 |
my @excluding = []; |
200 |
my @excluding = []; |
|
Lines 209-244
sub _search {
Link Here
|
| 209 |
push @value, $self->{'search_form'}; |
208 |
push @value, $self->{'search_form'}; |
| 210 |
} |
209 |
} |
| 211 |
|
210 |
|
| 212 |
if ($self->{'thesaurus'}) { |
211 |
if (C4::Context->preference("LinkerStrictAuthInfo") && $self->{'thesaurus'}) { |
| 213 |
if ($ind2 eq '0') { |
|
|
| 214 |
$subject_heading_thesaurus = 'a'; |
| 215 |
} elsif ($ind2 eq '1') { |
| 216 |
$subject_heading_thesaurus = 'b'; |
| 217 |
} elsif ($ind2 eq '2') { |
| 218 |
$subject_heading_thesaurus = 'c'; |
| 219 |
} elsif ($ind2 eq '3') { |
| 220 |
$subject_heading_thesaurus = 'd'; |
| 221 |
} elsif ($ind2 eq '4') { |
| 222 |
$subject_heading_thesaurus = 'n'; |
| 223 |
} elsif ($ind2 eq '5') { |
| 224 |
$subject_heading_thesaurus = 'k'; |
| 225 |
} elsif ($ind2 eq '6') { |
| 226 |
$subject_heading_thesaurus = 'v'; |
| 227 |
} else { |
| 228 |
$subject_heading_thesaurus = 'z'; |
| 229 |
} |
| 230 |
push @marclist, 'thesaurus'; |
212 |
push @marclist, 'thesaurus'; |
| 231 |
push @and_or, 'and'; |
213 |
push @and_or, 'and'; |
| 232 |
push @excluding, ''; |
214 |
push @excluding, ''; |
| 233 |
push @operator, 'is'; |
215 |
push @operator, 'is'; |
| 234 |
push @value, $subject_heading_thesaurus; |
|
|
| 235 |
} |
| 236 |
|
| 237 |
if ($ind2 eq '7') { |
| 238 |
push @marclist, 'thesaurus-conventions'; |
| 239 |
push @and_or, 'and'; |
| 240 |
push @excluding, ''; |
| 241 |
push @operator, 'is'; |
| 242 |
push @value, $self->{'thesaurus'}; |
216 |
push @value, $self->{'thesaurus'}; |
| 243 |
} |
217 |
} |
| 244 |
|
218 |
|
|
Lines 258-264
sub _search {
Link Here
|
| 258 |
\@value, $self->{'auth_type'}, |
232 |
\@value, $self->{'auth_type'}, |
| 259 |
'AuthidAsc' |
233 |
'AuthidAsc' |
| 260 |
); |
234 |
); |
| 261 |
return $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); |
235 |
my ( $authresults, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); |
|
|
236 |
if (C4::Context->preference("LinkerStrictAuthInfo") && ! $total && $ind2 eq '7') { |
| 237 |
for (my $i = $#value; $i >= 0; $i--) { |
| 238 |
# For the case when auth 008/11 was 'z', but thesaurus was not declared in 040 $f |
| 239 |
# (which is legal in MARC 21) we try to search again with 'other' (that stands |
| 240 |
# for 008/11 = 'z') instead of biblio 6XX $7 (i.e. $self->{'thesaurus'}) |
| 241 |
if ($value[$i] eq $self->{'thesaurus'} && $self->{'thesaurus'} ne 'notdefined') { |
| 242 |
$value[$i] = 'notdefined'; |
| 243 |
$search_query = $builder->build_authorities_query_compat( |
| 244 |
\@marclist, \@and_or, \@excluding, \@operator, |
| 245 |
\@value, $self->{'auth_type'}, |
| 246 |
'AuthidAsc' |
| 247 |
); |
| 248 |
( $authresults, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); |
| 249 |
last; |
| 250 |
} |
| 251 |
} |
| 252 |
} |
| 253 |
return ( $authresults, $total ); |
| 262 |
} |
254 |
} |
| 263 |
|
255 |
|
| 264 |
=head1 INTERNAL FUNCTIONS |
256 |
=head1 INTERNAL FUNCTIONS |