Bug 7617: Sort authority results by authid
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>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
parent
cf618fb80c
commit
ea334df3e6
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ sub _search {
|
|||
return C4::AuthoritiesMarc::SearchAuthorities(
|
||||
\@marclist, \@and_or, \@excluding, \@operator,
|
||||
\@value, 0, 20, $self->{'auth_type'},
|
||||
'', $skipmetadata
|
||||
'AuthidAsc', $skipmetadata
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ authority-zebra-indexdefs.xsl`
|
|||
<!-- 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 -->
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue