Bugzilla – Attachment 31314 Details for
Bug 9352
Zebra indexes useless subfields in UNIMARC 7XX
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH 3/3] Add a new XSLT template for indexing goup of subfields as a whole
0003-xslt.patch (text/plain), 8.11 KB, created by
Mathieu Saby
on 2014-09-01 21:48:07 UTC
(
hide
)
Description:
[PATCH 3/3] Add a new XSLT template for indexing goup of subfields as a whole
Filename:
MIME Type:
Creator:
Mathieu Saby
Created:
2014-09-01 21:48:07 UTC
Size:
8.11 KB
patch
obsolete
>From a74454a21893ae001db04ff74a48e9dda651462b Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathsabypro@gmail.com> >Date: Mon, 1 Sep 2014 23:33:49 +0200 >Subject: [PATCH 3/3] Add a new XSLT template for indexing goup of subfields as a whole >Content-Type: text/plain; charset="utf-8" > >This patch adds a new template in koha-indexdefs-to-zebra.xsl in order to index a specific goup of subfields as a whole. >It can be used for indexing as a "phrase" a string resulting from the concatenation of some indexes (with a space between them) >To use this new template, use the new "index_group_of_subfields" element in biblio-koha-indexdefs.xml, in the same way you used index_subfields > >Ex : to index the concatenation of "$a $b $d $g" subfields of 700 UNIMARC field in Author:p and Personal-name:p > <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="abdg"> > <target_index>Author:p</target_index> > <target_index>Personal-name:p</target_index> > </index_group_of_subfields> > > >This patch also change the biblio-koha-indexdefs.xml and biblio-zebra-indexdefs.xsl for UNIMARC >in order to index the "$a $b $d $g" of 700 UNIMARC field in Author:p and Personal-name:p >as explained in the example before > >To test : in a DOM UNIMARC Koha, apply all the patches, copy the modified files in your Zebra configuration directory, rebuild zebra, and make some tests > >Everything should be the same as when only the first 2 patches were applied, EXCEPT this behavior: >- create a record with 700$aDoe$bJohn (and nothing in 200$f or $g) >- Go in Advanced Search, and select the "Author as phrase" index >- with only the first 2 patches, you will have 0 result if you enter "Doe John" or "Doe John" >- with the 3 patches, you will have 1 result if you enter "Doe John" or "Doe John" > >Note that this it betten to test it in advanced search, because the behavior of "au" CCL index in simple search is maybe bugged (it searches the phrase index, while it should probably searches the word index) > >--- > .../unimarc/biblios/biblio-koha-indexdefs.xml | 4 ++ > .../unimarc/biblios/biblio-zebra-indexdefs.xsl | 15 +++++++ > etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 42 ++++++++++++++++++++ > 3 files changed, 61 insertions(+) > >diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >index 53a74ae..752287a 100644 >--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >@@ -302,6 +302,10 @@ > </index_subfields> > <!--700 : Physical author (main)--> > <!--Do not index $f (dates),$c (additions other than dates),$p (affiliation/address),$3,$4. Index $9 only in Koha-Auth-Number. Index $a in Author:s--> >+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="abdg"> >+ <target_index>Author:p</target_index> >+ <target_index>Personal-name:p</target_index> >+ </index_group_of_subfields> > <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="9"> > <target_index>Koha-Auth-Number:w</target_index> > <target_index>Koha-Auth-Number:n</target_index> >diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl >index 37d29e9..bd3b438 100644 >--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl >+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl >@@ -58,6 +58,21 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:value-of select="."/> > </z:index> > </xslo:template> >+ <xslo:template mode="index_subfields" match="marc:datafield[@tag='700']"> >+ <z:index name="Author:p Personal-name:p"> >+ <xslo:variable name="group_of_subfields"> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('abdg', @code)"> >+ <xslo:value-of select="."/> >+ <xslo:if test="position() != last()"> >+ <xslo:value-of select="substring(' ', 1, 1)"/> >+ </xslo:if> >+ </xslo:if> >+ </xslo:for-each> >+ </xslo:variable> >+ <xslo:value-of select="normalize-space($group_of_subfields)"/> >+ </z:index> >+ </xslo:template> > <xslo:template mode="index_subfields" match="marc:datafield[@tag='090']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('9', @code)"> >diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >index 1488b1c..1803103 100644 >--- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >+++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >@@ -14,6 +14,7 @@ > <!-- Keys on tags referenced in the index definitions --> > <xsl:key name="index_control_field_tag" match="kohaidx:index_control_field" use="@tag"/> > <xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/> >+ <xsl:key name="index_group_of_subfields_tag" match="kohaidx:index_group_of_subfields" use="@tag"/> > <xsl:key name="index_heading_tag" match="kohaidx:index_heading" use="@tag"/> > <xsl:key name="index_data_field_tag" match="kohaidx:index_data_field" use="@tag"/> > <xsl:key name="index_heading_conditional_tag" match="kohaidx:index_heading_conditional" use="@tag"/> >@@ -67,6 +68,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > > <xsl:call-template name="handle-index-leader"/> > <xsl:call-template name="handle-index-control-field"/> >+ <xsl:call-template name="handle-index-group-of-subfields"/> > <xsl:call-template name="handle-index-subfields"/> > <xsl:call-template name="handle-index-data-field"/> > <xsl:call-template name="handle-index-heading"/> >@@ -237,6 +239,46 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </z:index> > </xsl:template> > >+ <xsl:template name="handle-index-group-of-subfields"> >+ <xsl:for-each select="//kohaidx:index_group_of_subfields[generate-id() = generate-id(key('index_group_of_subfields_tag', @tag)[1])]"> >+ <xslo:template mode="index_subfields"> >+ <xsl:attribute name="match"> >+ <xsl:text>marc:datafield[@tag='</xsl:text> >+ <xsl:value-of select="@tag"/> >+ <xsl:text>']</xsl:text> >+ </xsl:attribute> >+ <xsl:for-each select="key('index_group_of_subfields_tag', @tag)"> >+ <xsl:call-template name="handle-one-group-of-subfields"/> >+ </xsl:for-each> >+ </xslo:template> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="handle-one-group-of-subfields"> >+ <xsl:variable name="indexes"> >+ <xsl:call-template name="get-target-indexes"/> >+ </xsl:variable> >+ <z:index> >+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute> >+ <xslo:variable name="group_of_subfields"> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if> >+ <xsl:attribute name="test"> >+ <xsl:text>contains('</xsl:text> >+ <xsl:value-of select="@subfields"/> >+ <xsl:text>', @code)</xsl:text> >+ </xsl:attribute> >+ <xslo:value-of select="."/> >+ <xslo:if test="position() != last()"> >+ <xslo:value-of select="substring(' ', 1, 1)"/> <!-- FIXME surely there's a better way to specify a space --> >+ </xslo:if> >+ </xslo:if> >+ </xslo:for-each> >+ </xslo:variable> >+ <xslo:value-of select="normalize-space($group_of_subfields)"/> >+ </z:index> >+ </xsl:template> >+ > <xsl:template name="handle-index-subfields"> > <xsl:for-each select="//kohaidx:index_subfields[generate-id() = generate-id(key('index_subfields_tag', @tag)[1])]"> > <xslo:template mode="index_subfields"> >-- >1.7.9.5 >
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 9352
:
14438
|
14439
|
15228
|
15229
|
17165
|
20677
|
21788
|
31031
|
31143
|
31151
|
31314
|
31380
|
31385
|
31386
|
31387
|
32097
|
32098
|
32099