Bug 9940: Add a new index for the original language of a document
authorMathieu Saby <mathieu.saby@univ-rennes2.fr>
Sun, 28 Apr 2013 12:44:21 +0000 (14:44 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 25 Dec 2013 15:37:14 +0000 (15:37 +0000)
It could be useful to index the original language of a document (i.e.
"fre" for the English translation of a French novel).

This patch renames the Bib-1 use attribute 1095 from
Code-language-original to language-original and uses it to index:

- MARC21 041$h subfield
- UNIMARC 101$c subfield

It adds "language-original" in the list of index in Search.pm.

Test plan :
A. in a MARC21 GRS1 environment
1. Copy Zebra config files (zebradb/biblios/etc/bib1.att,
   zebradb/ccl.properties, marc_defs/marc21/biblios/record.abs) from
   your source etc/ directory to your main koha etc/ directory
2. Reindex zebra
3. Make some searches, like "language-original:fre"
B. in a MARC21 DOM environment
4. Copy Zebra config files (zebradb/biblios/etc/bib1.att, zebradb/ccl.properties,
   marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl) from your source etc/
   directory to your main koha etc/ directory
5. Reindex zebra
6. Make some searches, like "language-original:fre"
C. in a UNIMARC GRS1 environment
7. Copy Zebra config files (zebradb/biblios/etc/bib1.att,
   zebradb/ccl.properties, marc_defs/unimarc/biblios/record.abs) from
   your source etc/ directory to your main koha etc/ directory
8. Reindex zebra
9. Make some searches, like "language-original:fre"
A. in a UNIMARC DOM environment
10. Copy Zebra config files (zebradb/biblios/etc/bib1.att,
    zebradb/ccl.properties, marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl)
    from your source etc/ directory to your main koha etc/ directory
11. Reindex zebra
12. Make some searches, like "language-original:fre"

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Search.pm
etc/zebradb/biblios/etc/bib1.att
etc/zebradb/ccl.properties
etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml
etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
etc/zebradb/marc_defs/marc21/biblios/record.abs
etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
etc/zebradb/marc_defs/unimarc/biblios/record.abs

index 8903ca7..18a0f5f 100644 (file)
@@ -987,6 +987,7 @@ sub getIndexes{
                     'Koha-Auth-Number',
                     'l-format',
                     'language',
+                    'language-original',
                     'lc-card',
                     'LC-card-number',
                     'lcn',
index 91aa696..4c67071 100644 (file)
@@ -162,7 +162,7 @@ att 1091    Identifier-ISRC
 att 1092    Identifier-ISMN
 att 1093    Identifier-ISRN
 att 1094    Identifier-DOI
-att 1095    Code-language-original
+att 1095    language-original
 att 1096    Title-later
 
 att 1185    Performer
index 14aa7b2..3a1c578 100644 (file)
@@ -254,6 +254,11 @@ Code-institution 1=56
 language 1=54
 ln language
 
+#
+#Code-language-original 1095 A code that indicates the       MARC21 041$h
+#                           original language of the item.   UNIMARC 101$c
+language-original 1=1095
+
 #Code-map-scale       1024  Coded form of cartographic      034
 #                           mathematical data, including
 #                           scale, projection and/or
index 731b8ad..ab00448 100644 (file)
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="041" subfields="e">
     <target_index>ln:w</target_index>
   </index_subfields>
+  <!--record.abs melm 041$h      language-original-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="041" subfields="h">
+    <target_index>language-original:w</target_index>
+  </index_subfields>
   <!--record.abs line 73: melm 041$j      ln-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="041" subfields="j">
     <target_index>ln:w</target_index>
index f8564ed..2cd7195 100644 (file)
@@ -180,6 +180,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       </xslo:if>
     </xslo:for-each>
     <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('h', @code)">
+        <z:index name="language-original:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+    <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('j', @code)">
         <z:index name="ln:w">
           <xslo:value-of select="."/>
index e17adb0..b4a79f8 100644 (file)
@@ -78,6 +78,7 @@ melm 040        Code-institution,Record-source
 melm 041$a      ln
 melm 041$d      ln
 melm 041$e      ln
+melm 041$h      language-original
 melm 041$j      ln
 melm 043        Code-geographic
 #melm 046       pubdate
index 3d926a3..d04d9d8 100644 (file)
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="101" subfields="a">
     <target_index>ln:w</target_index>
   </index_subfields>
+  <!--record.abs line 49: melm 101$h     language-original-->
+  <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="101" subfields="c">
+    <target_index>language-original:w</target_index>
+  </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-publication:w</target_index>
index de3f06f..eecdad7 100644 (file)
@@ -542,6 +542,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='101']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('c', @code)">
+        <z:index name="language-original:w">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='102']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
index aa0f74d..c4ce025 100644 (file)
@@ -104,6 +104,7 @@ melm 995$r      itemtype:w,itemtype:p,itype:w,itype:p
 # Script of title                       2                       34-35
 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)
 melm 101$a     ln
+melm 101$c     language-original
 melm 102$a     Country-publication
 
 # Field 105 Description