From a69071cb979372c0617ed87723470c10084f411a Mon Sep 17 00:00:00 2001 From: Barton Chittenden Date: Thu, 17 Dec 2015 09:17:23 -0800 Subject: [PATCH] Bug 14277 add zebra indexes for lexile that respect 521 indicator 1. 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 --- C4/Search.pm | 14 ++++++- etc/zebradb/biblios/etc/bib1.att | 6 ++- etc/zebradb/ccl.properties | 6 ++- .../marc21/biblios/biblio-koha-indexdefs.xml | 24 +++++++++--- .../marc21/biblios/biblio-zebra-indexdefs.xsl | 43 ++++++++++++++++++---- 5 files changed, 77 insertions(+), 16 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index e217f60..a9d05eb 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1021,6 +1021,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 @@ -1124,6 +1129,8 @@ sub getIndexes{ 'Illustration-code', 'Index-term-genre', 'Index-term-uncontrolled', + 'Interest-age-level', + 'Interest-grade-level', 'ISBN', 'isbn', 'ISSN', @@ -1138,6 +1145,7 @@ sub getIndexes{ 'LC-card-number', 'lcn', 'lex', + 'lexile-number', 'llength', 'ln', 'ln-audio', @@ -1174,6 +1182,7 @@ sub getIndexes{ 'Publisher', 'Provider', 'pv', + 'Reading-grade-level', 'Record-control-number', 'rcn', 'Record-type', @@ -1515,8 +1524,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 @@ -1745,6 +1754,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, diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att index d34325a..ff63a36 100644 --- a/etc/zebradb/biblios/etc/bib1.att +++ b/etc/zebradb/biblios/etc/bib1.att @@ -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 diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties index f65d269..58c38c9 100644 --- a/etc/zebradb/ccl.properties +++ b/etc/zebradb/ccl.properties @@ -1135,7 +1135,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 diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml index 6b1fb87..b16d779 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml @@ -571,11 +571,25 @@ Abstract:w Abstract:p - - - lex:w - lex:p - lex:n + + Reading-grade-level:w + Reading-grade-level:p + Reading-grade-level:n + + + Interest-age-level:w + Interest-age-level:p + Interest-age-level:n + + + Interest-grade-level:w + Interest-grade-level:p + Interest-grade-level:n + + + lexile-number:w + lexile-number:p + lexile-number:n diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl index 604c76a..d1c4e23 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl @@ -472,13 +472,42 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.1.4