Bugzilla – Attachment 140331 Details for
Bug 31532
Zebra search results including 880 with original script incorrect because of Bug 15187
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31532: Add preprocessor to Zebra indexing pipeline to index 880 as linked field
Bug-31532-Add-preprocessor-to-Zebra-indexing-pipel.patch (text/plain), 5.41 KB, created by
David Cook
on 2022-09-08 06:53:27 UTC
(
hide
)
Description:
Bug 31532: Add preprocessor to Zebra indexing pipeline to index 880 as linked field
Filename:
MIME Type:
Creator:
David Cook
Created:
2022-09-08 06:53:27 UTC
Size:
5.41 KB
patch
obsolete
>From 4d77ca5716276f67af57c4760fbe5a9fc0a92688 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 8 Sep 2022 05:06:38 +0000 >Subject: [PATCH] Bug 31532: Add preprocessor to Zebra indexing pipeline to > index 880 as linked field > >This patch adds a preprocessor XSLT to the Zebra indexing pipeline, >so that 880 fields get indexed as the fields they're linked to. For example, >a "880 $6 245" field would be indexed as a "245" field. > >However, because the preprocessor only occurs in the indexing part of the pipeline, >it does not affect the retrieval of MARCXML from Zebra. That MARCXML will be >the same MARCXML that was sent to Zebra from Koha. > >Test plan: > >0. Revert bug 15187, and apply patch for 31532 >1. cp ./etc/zebradb/biblios/etc/dom-config.xml /etc/koha/zebradb/biblios/etc/dom-config.xml >2a. cp etc/zebradb/marc_defs/marc21/biblios/preprocess_marcxml.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/. >2b. cp etc/zebradb/marc_defs/normarc/biblios/preprocess_marcxml.xsl /etc/koha/zebradb/marc_defs/normarc/biblios/. >2c. cp etc/zebradb/marc_defs/unimarc/biblios/preprocess_marcxml.xsl /etc/koha/zebradb/marc_defs/unimarc/biblios/. >3. koha-rebuild-zebra -b -f -v kohadev >4. Note that in search results the 880$6245$a data appears before the 245$a data >5. Note that you can do a title index search on the 880$6245$a data >--- > etc/zebradb/biblios/etc/dom-config.xml | 1 + > .../marc21/biblios/preprocess_marcxml.xsl | 23 +++++++++++++++++++ > .../normarc/biblios/preprocess_marcxml.xsl | 23 +++++++++++++++++++ > .../unimarc/biblios/preprocess_marcxml.xsl | 16 +++++++++++++ > 4 files changed, 63 insertions(+) > create mode 100644 etc/zebradb/marc_defs/marc21/biblios/preprocess_marcxml.xsl > create mode 100644 etc/zebradb/marc_defs/normarc/biblios/preprocess_marcxml.xsl > create mode 100644 etc/zebradb/marc_defs/unimarc/biblios/preprocess_marcxml.xsl > >diff --git a/etc/zebradb/biblios/etc/dom-config.xml b/etc/zebradb/biblios/etc/dom-config.xml >index e6eb89fdf2..47ae7289e0 100644 >--- a/etc/zebradb/biblios/etc/dom-config.xml >+++ b/etc/zebradb/biblios/etc/dom-config.xml >@@ -28,6 +28,7 @@ Bibliographic DOM config for MARC XML input > --> > <dom> > <extract name="index"> >+ <xslt stylesheet="preprocess_marcxml.xsl"/> > <xslt stylesheet="biblio-zebra-indexdefs.xsl"/> > </extract> > <retrieve name="marc"> >diff --git a/etc/zebradb/marc_defs/marc21/biblios/preprocess_marcxml.xsl b/etc/zebradb/marc_defs/marc21/biblios/preprocess_marcxml.xsl >new file mode 100644 >index 0000000000..8140c0af59 >--- /dev/null >+++ b/etc/zebradb/marc_defs/marc21/biblios/preprocess_marcxml.xsl >@@ -0,0 +1,23 @@ >+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:marc="http://www.loc.gov/MARC21/slim" >+ version="1.0"> >+<xsl:output indent="yes" >+ method="xml" >+ version="1.0" >+ encoding="UTF-8"/> >+ >+ <xsl:template name="identity" match="node()|@*"> >+ <xsl:copy> >+ <xsl:apply-templates select="@*|node()"/> >+ </xsl:copy> >+ </xsl:template> >+ >+ <xsl:template match="marc:datafield[@tag=880]"> >+ <xsl:element name="datafield" namespace="http://www.loc.gov/MARC21/slim"> >+ <xsl:attribute name="tag"><xsl:value-of select="substring(marc:subfield[@code=6],1,3)"/></xsl:attribute> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1"/></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2"/></xsl:attribute> >+ <xsl:apply-templates select="marc:subfield[@code != '6']"/> >+ </xsl:element> >+</xsl:template> >+ >+</xsl:stylesheet> >diff --git a/etc/zebradb/marc_defs/normarc/biblios/preprocess_marcxml.xsl b/etc/zebradb/marc_defs/normarc/biblios/preprocess_marcxml.xsl >new file mode 100644 >index 0000000000..8140c0af59 >--- /dev/null >+++ b/etc/zebradb/marc_defs/normarc/biblios/preprocess_marcxml.xsl >@@ -0,0 +1,23 @@ >+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:marc="http://www.loc.gov/MARC21/slim" >+ version="1.0"> >+<xsl:output indent="yes" >+ method="xml" >+ version="1.0" >+ encoding="UTF-8"/> >+ >+ <xsl:template name="identity" match="node()|@*"> >+ <xsl:copy> >+ <xsl:apply-templates select="@*|node()"/> >+ </xsl:copy> >+ </xsl:template> >+ >+ <xsl:template match="marc:datafield[@tag=880]"> >+ <xsl:element name="datafield" namespace="http://www.loc.gov/MARC21/slim"> >+ <xsl:attribute name="tag"><xsl:value-of select="substring(marc:subfield[@code=6],1,3)"/></xsl:attribute> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1"/></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2"/></xsl:attribute> >+ <xsl:apply-templates select="marc:subfield[@code != '6']"/> >+ </xsl:element> >+</xsl:template> >+ >+</xsl:stylesheet> >diff --git a/etc/zebradb/marc_defs/unimarc/biblios/preprocess_marcxml.xsl b/etc/zebradb/marc_defs/unimarc/biblios/preprocess_marcxml.xsl >new file mode 100644 >index 0000000000..f2f8134767 >--- /dev/null >+++ b/etc/zebradb/marc_defs/unimarc/biblios/preprocess_marcxml.xsl >@@ -0,0 +1,16 @@ >+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:marc="http://www.loc.gov/MARC21/slim" >+ version="1.0"> >+<xsl:output indent="yes" >+ method="xml" >+ version="1.0" >+ encoding="UTF-8"/> >+ >+ <xsl:template name="identity" match="node()|@*"> >+ <xsl:copy> >+ <xsl:apply-templates select="@*|node()"/> >+ </xsl:copy> >+ </xsl:template> >+ >+<!-- There's nothing to do here for UNIMARC but we need this file since the dom-config.xml file is cross-format --> >+ >+</xsl:stylesheet> >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31532
:
140331
|
140760
|
141337