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") && $self->{'thesaurus'} && ! $total && $ind2 eq '7') { |
237 |
# For the case when auth 008/11 was 'z', but thesaurus was not declared in 040 $f |
238 |
# (which is legal in MARC 21) we try to search again with 'other' (that stands |
239 |
# for 008/11 = 'z') instead of biblio 6XX $7 (i.e. $self->{'thesaurus'}) |
240 |
my $thesaurus_pos; |
241 |
for my $i (0..$#marclist) { |
242 |
if ($marclist[$i] eq 'thesaurus') { |
243 |
$thesaurus_pos = $i; |
244 |
last; |
245 |
} |
246 |
} |
247 |
if ($thesaurus_pos) { |
248 |
$value[$thesaurus_pos] = 'notdefined'; |
249 |
$search_query = $builder->build_authorities_query_compat( |
250 |
\@marclist, \@and_or, \@excluding, \@operator, |
251 |
\@value, $self->{'auth_type'}, |
252 |
'AuthidAsc' |
253 |
); |
254 |
( $authresults, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); |
255 |
} |
256 |
} |
257 |
return ( $authresults, $total ); |
262 |
} |
258 |
} |
263 |
|
259 |
|
264 |
=head1 INTERNAL FUNCTIONS |
260 |
=head1 INTERNAL FUNCTIONS |