Bug 14277: add zebra indexes for lexile that respect 521 indicator 1.
authorBarton Chittenden <barton@bywatersolutions.com>
Thu, 17 Dec 2015 17:17:23 +0000 (09:17 -0800)
committerJesse Weaver <jweaver@bywatersolutions.com>
Thu, 7 Apr 2016 16:35:18 +0000 (10:35 -0600)
Added the following indexes:

Interest-age-level | 591$a ind1=1
Interest-grade-level | 591$a ind1=2
lexile-number | 591$a ind1=8
Reading-grade-level | 591$a ind1=0

Moved 'lex' from a zebra index to a ccl alias to lexile-number.

Changed the handling of st-numeric in C4/Search.pm to allow for search ranges.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.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

index 2139c5a..9f8f219 100644 (file)
@@ -1020,6 +1020,11 @@ sub _build_weighted_query {
         $weighted_query .= "an=\"$operand\"";
     }
 
+    # If the index is numeric, don't autoquote it.
+    elsif ( $index =~ /,st-numeric$/ ) {
+        $weighted_query .= " $index=$operand";
+    }
+
     # If the index already has more than one qualifier, wrap the operand
     # in quotes and pass it back (assumption is that the user knows what they
     # are doing and won't appreciate us mucking up their query
@@ -1125,6 +1130,8 @@ sub getIndexes{
                     'Illustration-code',
                     'Index-term-genre',
                     'Index-term-uncontrolled',
+                    'Interest-age-level',
+                    'Interest-grade-level',
                     'ISBN',
                     'isbn',
                     'ISSN',
@@ -1139,6 +1146,7 @@ sub getIndexes{
                     'LC-card-number',
                     'lcn',
                     'lex',
+                    'lexile-number',
                     'llength',
                     'ln',
                     'ln-audio',
@@ -1175,6 +1183,7 @@ sub getIndexes{
                     'Publisher',
                     'Provider',
                     'pv',
+                    'Reading-grade-level',
                     'Record-control-number',
                     'rcn',
                     'Record-type',
@@ -1516,8 +1525,8 @@ sub buildQuery {
                 #which is processed higher up in this sub. Other than that, year searches are typically
                 #handled as limits which are not processed her either.
 
-                # Date of Publication
-                if ( $index =~ /yr/ ) {
+                # Search ranges: Date of Publication, st-numeric
+                if ( $index =~ /(yr|st-numeric)/ ) {
                     #weight_fields/relevance search causes errors with date ranges
                     #In the case of YYYY-, it will only return records with a 'yr' of YYYY (not the range)
                     #In the case of YYYY-YYYY, it will return no results
@@ -1746,6 +1755,7 @@ sub buildQuery {
         warn "LIMIT DESC:" . $limit_desc;
         warn "---------\nLeave buildQuery\n---------";
     }
+
     return (
         undef,              $query, $simple_query, $query_cgi,
         $query_desc,        $limit, $limit_cgi,    $limit_desc,
index d34325a..ff63a36 100644 (file)
@@ -351,7 +351,11 @@ att 9900    Author-personal-bibliography
 # Author-in-order - firstname lastname in 245$c statement of responsibility
 att 9902    Author-in-order
 # Lexile number
-att 9903    lex
+att 9903    lexile-number
+att 9908    Interest-age-level
+att 9909    Interest-grade-level
+att 9910    Reading-grade-level
+
 att 9904    arl
 att 9013    arp
 att 9520    Item
index 6ce7af0..873c749 100644 (file)
@@ -1137,7 +1137,11 @@ ff7-01-02 1=8703
 l-format ff7-01-02
 
 # Lexile Number
-lex 1=9903 r=r
+lexile-number 1=9903 r=r
+lex lexile-number
+Interest-age-level 1=9908 r=r
+Interest-grade-level 1=9909 r=r
+Reading-grade-level 1=9910 r=r
 
 #Accelerated Reader Level
 arl 1=9904 r=r
index 8c53c3a..31c46ce 100644 (file)
     <target_index>Abstract:w</target_index>
     <target_index>Abstract:p</target_index>
   </index_data_field>
-  <!--record.abs line 153: melm 521$a      lex:n-->
-  <index_subfields tag="521" subfields="a">
-    <target_index>lex:w</target_index>
-    <target_index>lex:p</target_index>
-    <target_index>lex:n</target_index>
+  <index_subfields tag="521" subfields="a" condition="@ind1='0'">
+    <target_index>Reading-grade-level:w</target_index>
+    <target_index>Reading-grade-level:p</target_index>
+    <target_index>Reading-grade-level:n</target_index>
+  </index_subfields>
+  <index_subfields tag="521" subfields="a" condition="@ind1='1'">
+    <target_index>Interest-age-level:w</target_index>
+    <target_index>Interest-age-level:p</target_index>
+    <target_index>Interest-age-level:n</target_index>
+  </index_subfields>
+  <index_subfields tag="521" subfields="a" condition="@ind1='2'">
+    <target_index>Interest-grade-level:w</target_index>
+    <target_index>Interest-grade-level:p</target_index>
+    <target_index>Interest-grade-level:n</target_index>
+  </index_subfields>
+  <index_subfields tag="521" subfields="a" condition="@ind1='8'">
+    <target_index>lexile-number:w</target_index>
+    <target_index>lexile-number:p</target_index>
+    <target_index>lexile-number:n</target_index>
   </index_subfields>
   <!--record.abs line 154: melm 526$c      arl,arl:n-->
   <index_subfields tag="526" subfields="c">
index 50c62d3..35ae241 100644 (file)
@@ -474,13 +474,42 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
     </xslo:for-each>
   </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='521']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('a', @code)">
-        <z:index name="lex:w lex:p lex:n">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
+    <xslo:if test="@ind1='0'">
+      <xslo:for-each select="marc:subfield">
+        <xslo:if test="contains('a', @code)">
+          <z:index name="Reading-grade-level:w Reading-grade-level:p Reading-grade-level:n">
+            <xslo:value-of select="."/>
+          </z:index>
+        </xslo:if>
+      </xslo:for-each>
+    </xslo:if>
+    <xslo:if test="@ind1='1'">
+      <xslo:for-each select="marc:subfield">
+        <xslo:if test="contains('a', @code)">
+          <z:index name="Interest-age-level:w Interest-age-level:p Interest-age-level:n">
+            <xslo:value-of select="."/>
+          </z:index>
+        </xslo:if>
+      </xslo:for-each>
+    </xslo:if>
+    <xslo:if test="@ind1='2'">
+      <xslo:for-each select="marc:subfield">
+        <xslo:if test="contains('a', @code)">
+          <z:index name="Interest-grade-level:w Interest-grade-level:p Interest-grade-level:n">
+            <xslo:value-of select="."/>
+          </z:index>
+        </xslo:if>
+      </xslo:for-each>
+    </xslo:if>
+    <xslo:if test="@ind1='8'">
+      <xslo:for-each select="marc:subfield">
+        <xslo:if test="contains('a', @code)">
+          <z:index name="lexile-number:w lexile-number:p lexile-number:n">
+            <xslo:value-of select="."/>
+          </z:index>
+        </xslo:if>
+      </xslo:for-each>
+    </xslo:if>
   </xslo:template>
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='526']">
     <xslo:for-each select="marc:subfield">