Bug 17788: (MARC21) Add $9 fields to Koha-Auth-Number:w index
authorTomas Cohen Arazi <tomascohen@theke.io>
Sat, 17 Dec 2016 12:25:54 +0000 (09:25 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 14 Feb 2017 13:58:23 +0000 (13:58 +0000)
Looking at the default framework's fields that are linked to authority
records, there's a divergence with the Zebra index definitions.

This yields to authority usage count be incorrect for users searching
for authority records.

MariaDB [koha_kohadev]> SELECT tagfield,tagsubfield,authtypecode FROM
marc_subfield_structure WHERE authtypecode IS NOT NULL AND
authtypecode<>'' AND frameworkcode='' GROUP BY
tagfield,tagsubfield,authtypecode ;
+----------+-------------+--------------+
| tagfield | tagsubfield | authtypecode |
+----------+-------------+--------------+
| 100      | a           | PERSO_NAME   |
| 110      | a           | CORPO_NAME   |
| 111      | a           | MEETI_NAME   |
| 130      | a           | UNIF_TITLE   |
| 440      | a           | UNIF_TITLE   |
| 600      | a           | PERSO_NAME   |
| 610      | a           | CORPO_NAME   |
| 611      | a           | MEETI_NAME   |
| 630      | a           | UNIF_TITLE   |
| 648      | a           | CHRON_TERM   |
| 650      | a           | TOPIC_TERM   |
| 651      | a           | GEOGR_NAME   |
| 654      | a           | TOPIC_TERM   |
| 655      | a           | GENRE/FORM   |
| 656      | a           | TOPIC_TERM   |
| 657      | a           | TOPIC_TERM   |
| 658      | a           | TOPIC_TERM   |
| 662      | a           | GEOGR_NAME   |
| 690      | a           | TOPIC_TERM   |
| 691      | a           | GEOGR_NAME   |
| 696      | a           | PERSO_NAME   |
| 697      | a           | CORPO_NAME   |
| 698      | a           | MEETI_NAME   |
| 699      | a           | UNIF_TITLE   |
| 700      | a           | PERSO_NAME   |
| 710      | a           | CORPO_NAME   |
| 711      | a           | MEETI_NAME   |
| 730      | a           | UNIF_TITLE   |
| 796      | a           | PERSO_NAME   |
| 797      | a           | CORPO_NAME   |
| 798      | a           | MEETI_NAME   |
| 799      | a           | UNIF_TITLE   |
| 800      | a           | PERSO_NAME   |
| 810      | a           | CORPO_NAME   |
| 811      | a           | MEETI_NAME   |
| 830      | a           | UNIF_TITLE   |
| 896      | a           | PERSO_NAME   |
| 897      | a           | CORPO_NAME   |
| 898      | a           | MEETI_NAME   |
| 899      | a           | UNIF_TITLE   |
+----------+-------------+--------------+

This patch adds the missing ones to the authority number index as it is
done for the rest of the fields.

To test:
- Verify that
etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml
contains intries pointing the $9 subfield of all the fields in the
'tagfield' column above, to the Koha-Auth-Number:w index.
- Sign off :-D

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

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

index 49f774a..355a6e3 100644 (file)
     <target_index>Subject:w</target_index>
     <target_index>Subject:p</target_index>
   </index_data_field>
+  <index_subfields tag="662" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
   <!--record.abs line 197: melm 690$9      Koha-Auth-Number    -->
   <index_subfields tag="690" subfields="9">
     <target_index>Koha-Auth-Number:w</target_index>
     <target_index>Subject:w</target_index>
     <target_index>Subject:p</target_index>
   </index_data_field>
+  <index_subfields tag="691" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="696" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="697" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="698" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="699" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
   <!--record.abs line 200: melm 700$9      Cross-Reference,Koha-Auth-Number-->
   <index_subfields tag="700" subfields="9">
     <target_index>Cross-Reference:w</target_index>
   <index_subfields tag="787" subfields="w">
     <target_index>Record-control-number:w</target_index>
   </index_subfields>
+  <index_subfields tag="796" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="797" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="798" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="799" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
   <!--record.abs line 244: melm 800$a      Name-and-title,Title-series:w,Title-series:p-->
   <index_subfields tag="800" subfields="a">
     <target_index>Name-and-title:w</target_index>
     <target_index>Title-series:w</target_index>
     <target_index>Title-series:p</target_index>
   </index_data_field>
+  <index_subfields tag="896" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="897" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="898" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
+  <index_subfields tag="899" subfields="9">
+    <target_index>Koha-Auth-Number:w</target_index>
+  </index_subfields>
   <!--record.abs line 268: melm 999$c      Local-Number:n,Local-Number:w,Local-Number:s-->
   <index_subfields tag="999" subfields="c">
     <target_index>Local-Number:n</target_index>
index 5feab04..c63bd5e 100644 (file)
@@ -746,6 +746,15 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       </xslo:if>
     </xslo:for-each>
   </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='662']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='690']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('9', @code)">
@@ -755,6 +764,51 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       </xslo:if>
     </xslo:for-each>
   </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='691']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='696']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='697']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='698']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='699']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='700']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('9', @code)">
@@ -995,6 +1049,42 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       </xslo:if>
     </xslo:for-each>
   </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='796']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='797']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='798']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='799']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='800']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
@@ -1101,6 +1191,42 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       </xslo:if>
     </xslo:for-each>
   </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='896']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='897']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='898']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='899']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('9', @code)">
+        <z:index name="Koha-Auth-Number:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='999']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('c', @code)">