@@ -, +, @@ etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml, etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl, etc/zebradb/marc_defs/marc21/authorities/record.abs, and etc/zebradb/marc_defs/unimarc/authorities/record.abs matches them heading is the first, if you selected FirstMatch, or last if you selected LastMatch --- C4/AuthoritiesMarc.pm | 17 ++++++++++------- C4/Heading.pm | 2 +- .../authorities/authority-koha-indexdefs.xml | 1 + .../authorities/authority-zebra-indexdefs.xsl | 2 +- .../marc_defs/marc21/authorities/record.abs | 2 +- .../marc_defs/unimarc/authorities/record.abs | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) --- a/C4/AuthoritiesMarc.pm +++ a/C4/AuthoritiesMarc.pm @@ -279,13 +279,16 @@ sub SearchAuthorities { } ## Adding order #$query=' @or @attr 7=2 @attr 1=Heading 0 @or @attr 7=1 @attr 1=Heading 1'.$query if ($sortby eq "HeadingDsc"); - my $orderstring= ($sortby eq "HeadingAsc"? - '@attr 7=1 @attr 1=Heading 0' - : - $sortby eq "HeadingDsc"? - '@attr 7=2 @attr 1=Heading 0' - :'' - ); + my $orderstring; + if ($sortby eq 'HeadingAsc') { + $orderstring = '@attr 7=1 @attr 1=Heading 0'; + } elsif ($sortby eq 'HeadingDsc') { + $orderstring = '@attr 7=2 @attr 1=Heading 0'; + } elsif ($sortby eq 'AuthidAsc') { + $orderstring = '@attr 7=1 @attr 1=Local-Number 0'; + } elsif ($sortby eq 'AuthidDsc') { + $orderstring = '@attr 7=2 @attr 1=Local-Number 0'; + } $query=($query?$query:"\@attr 1=_ALLRECORDS \@attr 2=103 ''"); $query="\@or $orderstring $query" if $orderstring; --- a/C4/Heading.pm +++ a/C4/Heading.pm @@ -205,7 +205,7 @@ sub _search { return C4::AuthoritiesMarc::SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value, 0, 20, $self->{'auth_type'}, - '', $skipmetadata + 'AuthidAsc', $skipmetadata ); } --- a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml +++ a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml @@ -23,6 +23,7 @@ authority-zebra-indexdefs.xsl` Local-Number:w + Local-Number:s --- a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl +++ a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl @@ -46,7 +46,7 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names). - + --- a/etc/zebradb/marc_defs/marc21/authorities/record.abs +++ a/etc/zebradb/marc_defs/marc21/authorities/record.abs @@ -11,7 +11,7 @@ systag sysno rank xpath enable all any -melm 001 Local-Number +melm 001 Local-Number,Local-Number:s melm 942$a authtype:w,authtype:p # Personal Name --- a/etc/zebradb/marc_defs/unimarc/authorities/record.abs +++ a/etc/zebradb/marc_defs/unimarc/authorities/record.abs @@ -11,7 +11,7 @@ systag sysno rank xpath enable all any -melm 001 Local-Number +melm 001 Local-Number,Local-Number:s melm 942$a authtype melm 152$b authtype:w,authtype:p --