Bug 30879: Add biblionumber as a sorting option in MARC21
This patch updates the Local-Number indexing by adding a zeropad option to Zebra indexing and adding this to the mapping files It also updates C4/Search.pm to allow biblionumber as an option To test: 1 - Apply patches 2 - copy etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl to /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 3 - Restart all, reindex zebra 4 - Browse to: http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=kw&q=a&sort_by=biblionumber_dsc&count=20 5 - Confirm records sorted correctly 6 - Browse to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=kw&q=a&sort_by=biblionumber_asc&count=20 7 - Confirm records sorted correctly Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
494a6d7863
commit
230bae0b02
|
|
@ -390,6 +390,12 @@ sub getRecords {
|
|||
elsif ( $sort eq "title_za" || $sort eq "title_dsc" ) {
|
||||
$sort_by .= "1=4 >i ";
|
||||
}
|
||||
elsif ( $sort eq "biblionumber_az" || $sort eq "biblionumber_asc" ) {
|
||||
$sort_by .= "1=12 <i ";
|
||||
}
|
||||
elsif ( $sort eq "biblionumber_za" || $sort eq "biblionumber_dsc" ) {
|
||||
$sort_by .= "1=12 >i ";
|
||||
}
|
||||
else {
|
||||
warn "Ignoring unrecognized sort '$sort' requested" if $sort_by;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1196,6 +1196,8 @@
|
|||
<index_subfields tag="999" subfields="c">
|
||||
<target_index>Local-Number:n</target_index>
|
||||
<target_index>Local-Number:w</target_index>
|
||||
</index_subfields>
|
||||
<index_subfields tag="999" subfields="c" zeropad="1">
|
||||
<target_index>Local-Number:s</target_index>
|
||||
</index_subfields>
|
||||
<!--record.abs line 269: melm 999$d biblioitemnumber:n,biblioitemnumber:w,biblioitemnumber:s-->
|
||||
|
|
|
|||
|
|
@ -1261,11 +1261,18 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
|
|||
<xslo:template mode="index_subfields" match="marc:datafield[@tag='999']">
|
||||
<xslo:for-each select="marc:subfield">
|
||||
<xslo:if test="contains('c', @code)">
|
||||
<z:index name="Local-Number:n Local-Number:w Local-Number:s">
|
||||
<z:index name="Local-Number:n Local-Number:w">
|
||||
<xslo:value-of select="."/>
|
||||
</z:index>
|
||||
</xslo:if>
|
||||
</xslo:for-each>
|
||||
<xslo:for-each select="marc:subfield">
|
||||
<xslo:if test="contains('c', @code)">
|
||||
<z:index name="Local-Number:s">
|
||||
<xslo:value-of select="format-number(.,"00000000000")"/>
|
||||
</z:index>
|
||||
</xslo:if>
|
||||
</xslo:for-each>
|
||||
<xslo:for-each select="marc:subfield">
|
||||
<xslo:if test="contains('d', @code)">
|
||||
<z:index name="biblioitemnumber:n biblioitemnumber:w biblioitemnumber:s">
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
|
|||
<xsl:template name="handle-one-index-subfields">
|
||||
<xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable>
|
||||
<xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable>
|
||||
<xsl:variable name="zeropad"><xsl:value-of select="@zeropad"/></xsl:variable>
|
||||
<xsl:variable name="indexes">
|
||||
<xsl:call-template name="get-target-indexes"/>
|
||||
</xsl:variable>
|
||||
|
|
@ -302,6 +303,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
|
|||
<xsl:value-of select="$length"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@zeropad">
|
||||
<xsl:text>format-number(.,"00000000000")</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>.</xsl:text>
|
||||
</xsl:otherwise>
|
||||
|
|
|
|||
Loading…
Reference in New Issue