Bug 14332 introduced troubles because the koha-indexdefs-to-zebra.xsl is by no means MARC21-only or even biblio-only. To reproduce: - On current master, run: $ xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl - Run: $ git diff => FAIL: The following is added to etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl, thus UNIMARC field 245 is being sent to the Title index @@ -42,6 +43,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) <xslo:apply-templates mode="index_match_heading"/> <xslo:apply-templates mode="index_subject_thesaurus"/> <xslo:apply-templates mode="index_all"/> + <xslo:apply-templates mode="index_sort_tit"/> </z:record> </xslo:template> <xslo:template match="marc:controlfield[@tag='001']"> @@ -2681,6 +2683,19 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) <xslo:value-of select="."/> </z:index> </xslo:template> + <xslo:template mode="index_sort_tit" match="marc:datafield[@tag='245']"> + <xslo:variable name="chop"> + <xslo:choose> + <xslo:when test="not(number(@ind2))">0</xslo:when> + <xslo:otherwise> + <xslo:value-of select="number(@ind2)"/> + </xslo:otherwise> + </xslo:choose> + </xslo:variable> + <z:index name="Title:s"> + <xslo:value-of select="substring(marc:subfield[@code='a'], $chop+1)"/> + </z:index> + </xslo:template>
+1 Very strange to see hardcoded field 245
Created attachment 120943 [details] [review] Bug 18540: Handle indexing sort title only when needed This patch moves the code that generates the xsl for MARC21 biblio sorting to it's own template that is only called when specified in the xml To test: 1 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 2 - git diff 3 - Note that authority-zebra-indexdefs.xsl now has 245 Title:s info 4 - Apply patch 5 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 6 - git diff 7 - There are lines added about title sort, but no 245 block 8 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 9 - git diff 10 - Note lines changes to ...title_sort 11 - 245 block does not change
Created attachment 128724 [details] [review] Bug 18540: Handle indexing sort title only when needed This patch moves the code that generates the xsl for MARC21 biblio sorting to it's own template that is only called when specified in the xml To test: 1 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 2 - git diff 3 - Note that authority-zebra-indexdefs.xsl now has 245 Title:s info 4 - Apply patch 5 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 6 - git diff 7 - There are lines added about title sort, but no 245 block 8 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 9 - git diff 10 - Note lines changes to ...title_sort 11 - 245 block does not change Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Created attachment 129165 [details] [review] Bug 18540: Handle indexing sort title only when needed This patch moves the code that generates the xsl for MARC21 biblio sorting to it's own template that is only called when specified in the xml To test: 1 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 2 - git diff 3 - Note that authority-zebra-indexdefs.xsl now has 245 Title:s info 4 - Apply patch 5 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 6 - git diff 7 - There are lines added about title sort, but no 245 block 8 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 9 - git diff 10 - Note lines changes to ...title_sort 11 - 245 block does not change Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 129166 [details] [review] Bug 18540: (QA follow-up) Only mention index_sort_title if defined This patch makes the generated xslt not mention index_sort_title unless the entry is defined on the xml file. Otherwise there's a call to <xslo:apply-templates mode="index_sort_title"/> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 129167 [details] [review] Bug 18540: Update MARC21 biblio XSL file I ran the xsltproc on both MARC21 and UNIMARC files (biblios and authorities). With my follow-up the only changed one is this one. I skipped NORMARC as it is supposed to be removed by now (so unused in Norway). Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.03
Pushed to 21.05.x for 21.05.11
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.