The Heading-Main and Any indexes were not defined in the MARC21 authority DOM
rules, but was enabled by the fix for bug 5924. This patch adds the Heading-Main
and Any indexes to the MARC21 DOM authority configuration.

This is a revised patch, with the authority-zebra-indexdefs.xsl automatically
generated from authority-koha-indexdefs.xml. Note that Any is added by
koha-indexdefs-to-zebra.xsl rather than in the authority-koha-indexdefs.xml
file.

Signed-off-by: Jared Camins-Esakov <[email protected]>
---
 .../authorities/authority-koha-indexdefs.xml       |   42 +++++-
 .../authorities/authority-zebra-indexdefs.xsl      |  165 ++++++++++++++++++++
 .../marc21/authorities/koha-indexdefs-to-zebra.xsl |    5 +
 3 files changed, 211 insertions(+), 1 deletions(-)

diff --git 
a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml 
b/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml
index 8b56ad0..2515317 100644
--- a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml
+++ b/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml
@@ -53,11 +53,16 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="100" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="100" subfields="abcdefghjklmnopqrstvxyz" 
subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
   </kohaidx:index_match_heading>
-  
+
   <kohaidx:index_heading tag="400" subfields="abcdefghjklmnopqrstvxyz" 
subdivisions="vxyz">
     <kohaidx:target_index>Personal-name-see-from:w</kohaidx:target_index>
     <kohaidx:target_index>Personal-name-see-from:p</kohaidx:target_index>
@@ -93,6 +98,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="110" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="110" subfields="abcdefghklmnoprstvxyz" 
subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -133,6 +143,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="111" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="111" subfields="acdefghjklnpqstvxyz" 
subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -173,6 +188,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="130" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="130" subfields="adfghklmnoprstvxyz" 
subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -213,6 +233,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="148" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="148" subfields="avxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -254,6 +279,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="150" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="150" subfields="abvxyz" 
subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -294,6 +324,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="151" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="151" subfields="avxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -334,6 +369,11 @@
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="155" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="155" subfields="avxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
diff --git 
a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl 
b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
index c05b711..9538e6f 100644
--- a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
+++ b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
@@ -161,6 +161,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='400']">
     <z:index name="Personal-name-see-from:w Personal-name-see-from:p 
Personal-name-see-from:s See-from:w See-from:p See-from:s">
@@ -227,6 +247,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='410']">
     <z:index name="Corporate-name-see-from:w Corporate-name-see-from:p 
Corporate-name-see-from:s See-from:w See-from:p See-from:s">
@@ -293,6 +333,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='411']">
     <z:index name="Meeting-name-see-from:w Meeting-name-see-from:p 
Meeting-name-see-from:s See-from:w See-from:p See-from:s">
@@ -359,6 +419,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='430']">
     <z:index name="Title-uniform-see-from:w Title-uniform-see-from:p 
Title-uniform-see-from:s See-from:w See-from:p See-from:s">
@@ -425,6 +505,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='448']">
     <z:index name="Chronological-term-see-from:w Chronological-term-see-from:p 
Chronological-term-see-from:s See-from:w See-from:p See-from:s">
@@ -491,6 +591,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='450']">
     <z:index name="Subject-topical-see-from:w Subject-topical-see-from:p 
Subject-topical-see-from:s See-from:w See-from:p See-from:s">
@@ -557,6 +677,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='451']">
     <z:index name="Name-geographic-see-from:w Name-geographic-see-from:p 
Name-geographic-see-from:s See-from:w See-from:p See-from:s">
@@ -623,6 +763,26 @@
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w 
Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='455']">
     <z:index name="Term-genre-form-see-from:w Term-genre-form-see-from:p 
Term-genre-form-see-from:s See-from:w See-from:p See-from:s">
@@ -1826,4 +1986,9 @@
       <xslo:value-of select="$full_thesaurus_code"/>
     </z:index>
   </xslo:template>
+  <xslo:template match="*">
+    <z:index name="Any:w Any:p">
+      <xslo:value-of select="."/>
+    </z:index>
+  </xslo:template>
 </xslo:stylesheet>
diff --git 
a/etc/zebradb/marc_defs/marc21/authorities/koha-indexdefs-to-zebra.xsl 
b/etc/zebradb/marc_defs/marc21/authorities/koha-indexdefs-to-zebra.xsl
index 57c6321..d466611 100644
--- a/etc/zebradb/marc_defs/marc21/authorities/koha-indexdefs-to-zebra.xsl
+++ b/etc/zebradb/marc_defs/marc21/authorities/koha-indexdefs-to-zebra.xsl
@@ -54,6 +54,11 @@
             <xsl:call-template name="handle-index-heading"/>
             <xsl:call-template name="handle-index-match-heading"/>
             <xsl:apply-templates/>
+            <xslo:template match="*">
+                <z:index name="Any:w Any:p">
+                    <xslo:value-of select="."/>
+                </z:index>
+            </xslo:template>
         </xslo:stylesheet>
     </xsl:template>
 
-- 
1.7.2.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to