From 8a18adf1d15508a35b0c745a0bc99dfa95f1bd76 Mon Sep 17 00:00:00 2001 From: Bouzid Fergani Date: Fri, 14 Oct 2016 10:14:22 -0400 Subject: [PATCH] Bug 11300: small fix for adjust using first,last and default in result search, using index Match-heading for search - Rebase all patches . - Fix using first,last and default in result search. - Using index Match-heading for search z3950 server. --- C4/Linker/Z3950Server.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/C4/Linker/Z3950Server.pm b/C4/Linker/Z3950Server.pm index 366aca2..91bf235 100644 --- a/C4/Linker/Z3950Server.pm +++ b/C4/Linker/Z3950Server.pm @@ -57,18 +57,19 @@ sub get_link { # look for matching authorities my $authorities = $heading->authorities(1); # $skipmetadata = true - if ( $behavior eq 'default' && $#{$authorities} == 0 ) { + if ( $behavior eq 'default' && $#{$authorities} == 1 ) { $authid = $authorities->[0]->{'authid'}; } - elsif ( $behavior eq 'first' && $#{$authorities} >= 0 ) { - $authid = $authorities->[0]->{'authid'}; - $fuzzy = $#{$authorities} > 0; - } - elsif ( $behavior eq 'last' && $#{$authorities} >= 0 ) { - $authid = $authorities->[ $#{$authorities} ]->{'authid'}; - $fuzzy = $#{$authorities} > 0; + elsif ( $#{$authorities} > 1 ) { + if ($behavior eq 'first'){ + $authid = $authorities->[0]->{'authid'}; + $fuzzy = $#{$authorities} > 1; + } + else { + $authid = $authorities->[ $#{$authorities} - 1 ]->{'authid'}; + $fuzzy = $#{$authorities} > 1; + } } - if ( !defined $authid && $self->{'broader_headings'} ) { my $field = $heading->field(); my @subfields = $field->subfields(); @@ -166,7 +167,7 @@ sub getZ3950Authority { else { return; } - my $query =qq(Personal-name,do-not-truncate,ext="$heading->{'search_form'}"); + my $query =qq(Match-heading,do-not-truncate,ext="$heading->{'search_form'}"); my $zquery = eval{ new ZOOM::Query::CCL2RPN($query, $self->{'conn'}) }; if($@) { warn $query . "\n" . $@; -- 1.9.1