Add the option of sorting authority search results by authid, and instruct the
FirstMatch and LastMatch linkers to use that sort order rather than the default
search order.
To test:
1. Install new Zebra authorities config
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
2. Reindex authorities in Zebra
3. Set LinkerModule to FirstMatch or LastMatch
4. Add two identical authority records, and a bib record with a heading that
matches them
5. Run misc/link_bibs_to_authorities.pl on that record
6. Confirm that the authid that's been inserted into subfield $9 of that
heading is the first, if you selected FirstMatch, or last if you selected
LastMatch
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I followed the test plan and checked that for "Last match" and "First match"
the correct authority was selected and linked to the record.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
}
## Adding order
#$query=' @or @attr 7=2 @attr 1=Heading 0 @or @attr 7=1 @attr 1=Heading 1'.$query if ($sortby eq "HeadingDsc");
}
## 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;
$query=($query?$query:"\@attr 1=_ALLRECORDS \@attr 2=103 ''");
$query="\@or $orderstring $query" if $orderstring;
return C4::AuthoritiesMarc::SearchAuthorities(
\@marclist, \@and_or, \@excluding, \@operator,
\@value, 0, 20, $self->{'auth_type'},
return C4::AuthoritiesMarc::SearchAuthorities(
\@marclist, \@and_or, \@excluding, \@operator,
\@value, 0, 20, $self->{'auth_type'},
+ 'AuthidAsc', $skipmetadata
<!-- Original record ID -->
<kohaidx:index_control_field tag="001">
<kohaidx:target_index>Local-Number:w</kohaidx:target_index>
<!-- Original record ID -->
<kohaidx:index_control_field tag="001">
<kohaidx:target_index>Local-Number:w</kohaidx:target_index>
+ <kohaidx:target_index>Local-Number:s</kohaidx:target_index>
</kohaidx:index_control_field>
<!-- 008 -->
</kohaidx:index_control_field>
<!-- 008 -->
</z:index>
</xslo:template>
<xslo:template match="marc:controlfield[@tag='001']">
</z:index>
</xslo:template>
<xslo:template match="marc:controlfield[@tag='001']">
- <z:index name="Local-Number:w">
+ <z:index name="Local-Number:w Local-Number:s">
<xslo:value-of select="."/>
</z:index>
</xslo:template>
<xslo:value-of select="."/>
</z:index>
</xslo:template>
+melm 001 Local-Number,Local-Number:s
melm 942$a authtype:w,authtype:p
# Personal Name
melm 942$a authtype:w,authtype:p
# Personal Name
+melm 001 Local-Number,Local-Number:s
melm 942$a authtype
melm 152$b authtype:w,authtype:p
melm 942$a authtype
melm 152$b authtype:w,authtype:p