Bugzilla – Attachment 44769 Details for
Bug 14332
Skip title articles on Opac using ind2 of tag 245 (MARC21 only)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Skip articles in MARC21 using indicator n.2 of field 245
Skip-articles-in-MARC21-using-indicator-n2-of-fiel.patch (text/plain), 6.94 KB, created by
Frédéric Demians
on 2015-11-11 14:59:35 UTC
(
hide
)
Description:
Skip articles in MARC21 using indicator n.2 of field 245
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2015-11-11 14:59:35 UTC
Size:
6.94 KB
patch
obsolete
>From 1b75de75494b72f2474138fa17b93e2755b5bbdf Mon Sep 17 00:00:00 2001 >From: Zeno Tajoli <z.tajoli@cineca.it> >Date: Thu, 4 Jun 2015 17:27:10 +0200 >Subject: [PATCH] Skip articles in MARC21 using indicator n.2 of field 245 > >Only in MARC21 is possible to use ind2 of tag 245 to skip articles. >This patch is based on inserting a special template in >koha-indexdefs-to-zebra.xsl With this patch you must not insert index >Title:s in biblio-koha-indexdefs.xml, it is defined in >koha-indexdefs-to-zebra.xsl. It is not the best setup, but I find very >difficult to use biblio-koha-indexdefs.xml. > >To test it in a english MARC21 setup: > >Insert same records with titles and correct values in ind2 of 245. >If you have articles not in the skiping list of sort-string-utf.chr (The|the|a|A|an|An) >you can see that the sort by articles use also articles. > >Insert the patch >Rebuilt indexes from scratch > >Now all articles of titles are skipped > >TO TEST WITHOUT INDEXING: > >1. Go to etc/zebradb/marc_defs/marc21/biblios directory. > >2. Put the sample MARCXML file in this directory. > >3. Transform the file into Zebra indexes: > xsltproc biblio-zebra-indexdefs.xsl record.xml > Observe that the Title:s index contains: > 01 Business and Technologies > >4. Apply the patch. > >5. Repeat: > xsltproc biblio-zebra-indexdefs.xsl record.xml > Observe that the Title:s index contains: > Business and Technologies > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> > >http://bugs.koha-community.org/show_bug.cgi?id=14332 >--- > .../marc_defs/marc21/biblios/biblio-koha-indexdefs.xml | 1 - > .../marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl | 17 ++++++++++++++++- > etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 13 +++++++++++++ > 3 files changed, 29 insertions(+), 2 deletions(-) > >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >index 6b1fb87..8c53c3a 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >@@ -389,7 +389,6 @@ > <target_index>Title-cover:s</target_index> > <target_index>Title:w</target_index> > <target_index>Title:p</target_index> >- <target_index>Title:s</target_index> > </index_subfields> > <!--record.abs line 114: melm 245$c Author,Author-in-order:w,Author-in-order:p,Author-in-order:s--> > <index_subfields tag="245" subfields="c"> >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >index 604c76a..50c62d3 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >@@ -17,6 +17,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:template match="text()" mode="index_heading_conditional"/> > <xslo:template match="text()" mode="index_match_heading"/> > <xslo:template match="text()" mode="index_subject_thesaurus"/> >+ <xslo:template match="text()" mode="index_sort_tit"/> > <xslo:template match="/"> > <xslo:if test="marc:collection"> > <collection> >@@ -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:leader"> >@@ -318,7 +320,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:template mode="index_subfields" match="marc:datafield[@tag='245']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('a', @code)"> >- <z:index name="Title-cover:w Title-cover:p Title-cover:s Title:w Title:p Title:s"> >+ <z:index name="Title-cover:w Title-cover:p Title-cover:s Title:w Title:p"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >@@ -2464,6 +2466,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> > <xslo:template name="chopPunctuation"> > <xslo:param name="chopString"/> > <xslo:variable name="length" select="string-length($chopString)"/> >diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >index 9718e26..59876ca 100644 >--- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >+++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >@@ -39,6 +39,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:template match="text()" mode="index_heading_conditional"/> > <xslo:template match="text()" mode="index_match_heading"/> > <xslo:template match="text()" mode="index_subject_thesaurus"/> >+ <xslo:template match="text()" mode="index_sort_tit"/> > <xslo:template match="/"> > <xslo:if test="marc:collection"> > <collection> >@@ -65,6 +66,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> > >@@ -82,6 +84,17 @@ 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> > <xslo:template name="chopPunctuation"> > <xslo:param name="chopString"/> > <xslo:variable name="length" select="string-length($chopString)"/> >-- >2.6.2
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 14332
:
39870
|
44768
|
44769
|
46287
|
46288