Bug 8252: Fix indexing of UNIMARC 1xx for DOM
authorMathieu Saby <mathieu.saby@univ-rennes2.fr>
Wed, 27 Mar 2013 15:04:28 +0000 (16:04 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 10 Oct 2013 15:15:04 +0000 (15:15 +0000)
This patch makes the same changes in UNIMARC DOM configuration as patch
1 made for GRS-1.

positions of subfields are indexed that way :
In biblio-koha-indexdefs.xml :
tag="100" subfields="a" offset="17" length="1"
In biblio-zebra-indexdefs.xsl :
xslo:value-of select="substring(., 17, 1)"

I had to edit biblio-zebra-indexdefs.xsl by hand, because
etc/zebdradb/xml/koha-indexdefs-to-zebra.xsl does only support
"subtring" in handle-one-index-control-field template.

It is good for MARC21, but not for UNIMARC : in MARC21, indexing
subtrings is needed for controled field (001-009, with no subfields)
But in UNIMARC it is needed for subfields of 1XX fields.
So if DOM indexing is working with these new files, we may need to
change koha-indexdefs-to-zebra.xsl.

Test plan (not possible in a sandbox) :
1) In a Koha instance using UNIMARC and DOM indexing
2) Apply Patch 1 and Patch 2 (this one)
3) Copy the following files from the etc/zebradb directory of your
   source into the etc/zebradb directory of your main Koha directory :
-- etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
-- etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
-- etc/zebradb/ccl.properties
-- etc/zebradb/biblios/etc/bib1.att
4) rebuild zebra with -x -b -r -v options
5) check if coded filters in advanced search are usable in OPAC and
   Staff interface

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works. No koha-qa errors.

Test for DOM
Apply patches
Don't forget to copy files
reindex
Search by coded fields works, also Country-publication

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl

index ceaba51..9ceaa8e 100644 (file)
     <target_index>EAN:w</target_index>
     <target_index>Identifier-standard:w</target_index>
   </index_subfields>
-  <!--record.abs line 86: melm 200$b      itemtype:w,itemtype:p,itype:w,itype:p-->
+  <!--record.abs melm 200$b      itemtype:w,itemtype:p,itype:w,itype:p,Material-type:w,Material-type:p-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="200" subfields="b">
     <target_index>itemtype:w</target_index>
     <target_index>itemtype:p</target_index>
     <target_index>itype:w</target_index>
     <target_index>itype:p</target_index>
+    <target_index>Material-type:w</target_index>
+    <target_index>Material-type:p</target_index>
   </index_subfields>
   <!--record.abs line 87: melm 995$r      itemtype:w,itemtype:p,itype:w,itype:p-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="995" subfields="r">
     <target_index>itype:w</target_index>
     <target_index>itype:p</target_index>
   </index_subfields>
-  <!--record.abs line 48: melm 100$a      tpubdate:s:range(data,8,1),ta:w:range(data,17,1),ta:w:range(data,18,1),ta:w:range(data,19,1),Modified-code:n:range(data,21,1),ln:s:range(data,22,3),char-encoding:n:range(data,26,2),char-encoding:n:range(data,28,2),char-encoding:n:range(data,30,2),script-Title:n:range(data,34,2)-->
-  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a">
+  <!--record.abs melm 100$a      tpubdate:s:range(data,8,1),ta:w:range(data,17,1),ta:w:range(data,18,1),ta:w:range(data,19,1),Modified-code:n:range(data,21,1),char-encoding:n:range(data,26,2),char-encoding:n:range(data,28,2),char-encoding:n:range(data,30,2),script-Title:n:range(data,34,2)-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="8" length="1">
     <target_index>tpubdate:s</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="17" length="1">
     <target_index>ta:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="18" length="1">
     <target_index>ta:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="19" length="1">
     <target_index>ta:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="21" length="1">
     <target_index>Modified-code:n</target_index>
-    <target_index>ln:s</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="26" length="2">
     <target_index>char-encoding:n</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="28" length="2">
     <target_index>char-encoding:n</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="30" length="2">
     <target_index>char-encoding:n</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="100" subfields="a" offset="34" length="2">
     <target_index>script-Title:n</target_index>
   </index_subfields>
   <!--record.abs line 49: melm 101$a     ln-->
   </index_subfields>
   <!--record.abs line 50: melm 102$a     Country-heading-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="102" subfields="a">
-    <target_index>Country-heading:w</target_index>
-  </index_subfields>
-  <!--record.abs line 60: melm 105$a     Illustration-code:w:range(data,0,4),Content-type:w:range(data,4,1),Content-type:w:range(data,5,1),Content-type:w:range(data,6,1),Content-type:w:range(data,7,1),Conference-code:w:range(data,8,1),Festschrift-indicator:w:range(data,9,1),Index-indicator:w:range(data,10,1),Literature-Code:w:range(data,11,1),Biography-Code:w:range(data,12,1)-->
-  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a">
-    <target_index>Illustration-code:w</target_index>
-    <target_index>Content-type:w</target_index>
-    <target_index>Content-type:w</target_index>
-    <target_index>Content-type:w</target_index>
-    <target_index>Content-type:w</target_index>
-    <target_index>Conference-code:w</target_index>
-    <target_index>Festschrift-indicator:w</target_index>
-    <target_index>Index-indicator:w</target_index>
-    <target_index>Literature-Code:w</target_index>
-    <target_index>Biography-Code:w</target_index>
-  </index_subfields>
-  <!--record.abs line 62: melm 106$a     itype:w,itype:p-->
+    <target_index>Country-publication:w</target_index>
+  </index_subfields>
+  <!--record.abs melm 105$a ff8-18-21:w:range(data,0,1),ff8-18-21:w:range(data,1,1),ff8-18-21:w:range(data,2,1),ff8-18-21:w:range(data,3,1),ctype:w:range(data,4,1),ctype:w:range(data,5,1),ctype:w:range(data,6,1),ctype:w:range(data,7,1),ff8-29:w:range(data,8,1),ff8-30:w:range(data,9,1),ff8-31:w:range(data,10,1),lf:w:range(data,11,1),bio:w:range(data,12,1)-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="0" length="1">
+    <target_index>ff8-18-21:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="1" length="1">
+    <target_index>ff8-18-21:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="2" length="1">
+    <target_index>ff8-18-21:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="3" length="1">
+    <target_index>ff8-18-21:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="4" length="1">
+    <target_index>ctype:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="5" length="1">
+    <target_index>ctype:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="6" length="1">
+    <target_index>ctype:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="7" length="1">
+    <target_index>ctype:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="8" length="1">
+    <target_index>ff8-29:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="9" length="1">
+    <target_index>ff8-30:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="10" length="1">
+    <target_index>ff8-31:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="11" length="1">
+    <target_index>lf:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="105" subfields="a" offset="12" length="1">
+    <target_index>bio:w</target_index>
+  </index_subfields>
+  <!--record.abs melm 106$a     ff8-23:w,ff8-23:p-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="106" subfields="a">
-    <target_index>itype:w</target_index>
-    <target_index>itype:p</target_index>
+    <target_index>ff8-23:w</target_index>
+    <target_index>ff8-23:p</target_index>
+  </index_subfields>
+  <!--record.abs melm 110$a     ff8-21:w:range(data,0,1),ff8-18:w:range(data,1,1),ff8-19:w:range(data,2,1),ctype:w:range(data,3,1),ctype:w:range(data,4,3),ff8-29:w:range(data,7,1),Title-Page-availability-Code:w:range(data,8,1),ff8-31:w:range(data,9,1),Cumulative-Index-availability-Code:w:range(data,10,1)-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="0" length="1">
+    <target_index>ff8-21:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="1" length="1">
+    <target_index>ff8-18:w</target_index>
   </index_subfields>
-  <!--record.abs line 75: melm 110$a     Type-Of-Serial:w:range(data,0,1),Frequency-code:w:range(data,1,1),Regularity-code:w:range(data,2,1),Content-type:w:range(data,3,1),Content-type:w:range(data,4,3),Conference-publication-Code:w:range(data,7,1),Title-Page-availability-Code:w:range(data,8,1),Index-availability-Code:w:range(data,9,1),Cumulative-Index-availability-Code:w:range(data,10,1)-->
-  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a">
-    <target_index>Type-Of-Serial:w</target_index>
-    <target_index>Frequency-code:w</target_index>
-    <target_index>Regularity-code:w</target_index>
-    <target_index>Content-type:w</target_index>
-    <target_index>Content-type:w</target_index>
-    <target_index>Conference-publication-Code:w</target_index>
-    <target_index>Title-Page-availability-Code:w</target_index>
-    <target_index>Index-availability-Code:w</target_index>
-    <target_index>Cumulative-Index-availability-Code:w</target_index>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="2" length="1">
+    <target_index>ff8-19:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="3" length="1">
+    <target_index>ctype:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="4" length="1">
+    <target_index>ctype:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="7" length="1">
+    <target_index>ff8-29:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="8" length="1">
+    <target_index>Title-page-availability:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="9" length="1">
+    <target_index>ff8-31:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="110" subfields="a" offset="10" length="1">
+    <target_index>Cumulative-index-availability:w</target_index>
   </index_subfields>
   <!--record.abs line 77: melm 115$a     Video-mt:w:range(data,0,1)-->
-  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="115" subfields="a">
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="115" subfields="a" offset="0" length="1">
     <target_index>Video-mt:w</target_index>
   </index_subfields>
   <!--record.abs line 79: melm 116$a     Graphics-type:w:range(data,0,1),Graphics-support:w:range(data,1,1),Graphics-support:w:range(data,2,1),-->
-  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="116" subfields="a">
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="116" subfields="a" offset="0" length="1">
     <target_index>Graphics-type:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="116" subfields="a" offset="1" length="1">
     <target_index>Graphics-support:w</target_index>
+  </index_subfields>
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="116" subfields="a" offset="2" length="1">
     <target_index>Graphics-support:w</target_index>
   </index_subfields>
   <!--record.abs line 92: melm 200$f           Author:w,Author:p-->
index f1e82e3..8649a96 100644 (file)
@@ -305,7 +305,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='200']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('b', @code)">
-        <z:index name="itemtype:w itemtype:p itype:w itype:p">
+        <z:index name="itemtype:w itemtype:p itype:w itype:p Material-type:w Material-type:p">
           <xslo:value-of select="."/>
         </z:index>
       </xslo:if>
@@ -456,8 +456,64 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="tpubdate:s ta:w ta:w ta:w Modified-code:n ln:s char-encoding:n char-encoding:n char-encoding:n script-Title:n">
-          <xslo:value-of select="."/>
+        <z:index name="tpubdate:s">
+          <xslo:value-of select="substring(., 8, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ta:w">
+          <xslo:value-of select="substring(., 17, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ta:w">
+          <xslo:value-of select="substring(., 18, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ta:w">
+          <xslo:value-of select="substring(., 19, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="Modified-code:n">
+          <xslo:value-of select="substring(., 21, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="char-encoding:n">
+          <xslo:value-of select="substring(., 26, 2)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="char-encoding:n">
+          <xslo:value-of select="substring(., 28, 2)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="char-encoding:n">
+          <xslo:value-of select="substring(., 30, 2)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="script-Title:n">
+          <xslo:value-of select="substring(., 34, 2)"/>
         </z:index>
       </xslo:if>
     </xslo:for-each>
@@ -474,7 +530,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='102']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="Country-heading:w">
+        <z:index name="Country-publication:w">
           <xslo:value-of select="."/>
         </z:index>
       </xslo:if>
@@ -483,8 +539,92 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='105']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="Illustration-code:w Content-type:w Content-type:w Content-type:w Content-type:w Conference-code:w Festschrift-indicator:w Index-indicator:w Literature-Code:w Biography-Code:w">
-          <xslo:value-of select="."/>
+        <z:index name="ff8-18-21:w">
+          <xslo:value-of select="substring(., 0, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-18-21:w">
+          <xslo:value-of select="substring(., 1, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-18-21:w">
+          <xslo:value-of select="substring(., 2, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-18-21:w">
+          <xslo:value-of select="substring(., 3, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ctype:w">
+          <xslo:value-of select="substring(., 4, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ctype:w">
+          <xslo:value-of select="substring(., 5, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ctype:w">
+          <xslo:value-of select="substring(., 6, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ctype:w">
+          <xslo:value-of select="substring(., 7, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-29:w">
+          <xslo:value-of select="substring(., 8, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-30:w">
+          <xslo:value-of select="substring(., 9, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-31:w">
+          <xslo:value-of select="substring(., 10, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="lf:w">
+          <xslo:value-of select="substring(., 11, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="bio:w">
+          <xslo:value-of select="substring(., 12, 1)"/>
         </z:index>
       </xslo:if>
     </xslo:for-each>
@@ -492,7 +632,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='106']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="itype:w itype:p">
+        <z:index name="ff8-23:w iff8-23:p">
           <xslo:value-of select="."/>
         </z:index>
       </xslo:if>
@@ -501,8 +641,64 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='110']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="Type-Of-Serial:w Frequency-code:w Regularity-code:w Content-type:w Content-type:w Conference-publication-Code:w Title-Page-availability-Code:w Index-availability-Code:w Cumulative-Index-availability-Code:w">
-          <xslo:value-of select="."/>
+        <z:index name="ff8-21:w">
+          <xslo:value-of select="substring(., 0, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-18:w">
+          <xslo:value-of select="substring(., 1, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-19:w">
+          <xslo:value-of select="substring(., 2, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ctype:w">
+          <xslo:value-of select="substring(., 3, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ctype:w">
+          <xslo:value-of select="substring(., 4, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-29:w">
+          <xslo:value-of select="substring(., 7, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="Title-page-availability:w">
+          <xslo:value-of select="substring(., 8, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="ff8-31:w">
+          <xslo:value-of select="substring(., 9, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="Cumulative-index-availability:w">
+          <xslo:value-of select="substring(., 10, 1)"/>
         </z:index>
       </xslo:if>
     </xslo:for-each>
@@ -511,7 +707,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
         <z:index name="Video-mt:w">
-          <xslo:value-of select="."/>
+          <xslo:value-of select="substring(., 0, 1)"/>
         </z:index>
       </xslo:if>
     </xslo:for-each>
@@ -519,8 +715,22 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='116']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="Graphics-type:w Graphics-support:w Graphics-support:w">
-          <xslo:value-of select="."/>
+        <z:index name="Graphics-type:w">
+          <xslo:value-of select="substring(., 0, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="Graphics-support:w">
+          <xslo:value-of select="substring(., 1, 1)"/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="Graphics-support:w">
+          <xslo:value-of select="substring(., 2, 1)"/>
         </z:index>
       </xslo:if>
     </xslo:for-each>