Backport minimal fixes from r14825 and r14826 to address ISSN ingest and retrieval...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 Nov 2009 02:03:42 +0000 (02:03 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 Nov 2009 02:03:42 +0000 (02:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@14834 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
Open-ILS/src/sql/Pg/reporter-schema.sql

index 5756291..d072553 100644 (file)
@@ -706,8 +706,9 @@ sub xpath_to_string {
                }
        }
 
-    $string =~ s/(\w+)\/(\w+)/$1 $2/sgo;
-    $string =~ s/(\d{4})-(\d{4})/$1 $2/sgo;
+       $string =~ s/(\w+)\/(\w+)/$1 $2/sgo;
+       # Split date ranges and ISSNs on the hyphen
+       $string =~ s/(\d{4})-(\d{3,4}x?)/ $1 $2 /goi;
 
        return NFD($string);
 }
@@ -914,8 +915,9 @@ sub _marcxml_to_full_rows {
                        $val =~ s/\pM+//sgo;
                        $val =~ s/\pC+//sgo;
                        $val =~ s/\W+$//sgo;
-            $val =~ s/(\w+)\/(\w+)/$1 $2/sgo;
-            $val =~ s/(\d{4})-(\d{4})/$1 $2/sgo;
+                       $val =~ s/(\w+)\/(\w+)/$1 $2/sgo;
+                       # Split date ranges and ISSNs on the hyphen
+                       $val =~ s/(\d{4})-(\d{3,4}x?)/ $1 $2 /goi;
                        $ns->value( lc($val) );
 
                        push @ns_list, $ns;
index bd65b9d..660a1ef 100644 (file)
@@ -127,7 +127,7 @@ SELECT      r.id,
        series_statement.value AS series_statement,
        summary.value AS summary,
        ARRAY_ACCUM( SUBSTRING(isbn.value FROM $$^\S+$$) ) AS isbn,
-       ARRAY_ACCUM( SUBSTRING(issn.value FROM $$^\S+$$) ) AS issn,
+       ARRAY_ACCUM( REGEXP_REPLACE(issn.value, E'^\\S*(\\d{4})[-\\s](\\d{3,4}x?)', E'\\1 \\2') ) AS issn,
        ARRAY((SELECT DISTINCT value FROM metabib.full_rec WHERE tag = '650' AND subfield = 'a' AND record = r.id)) AS topic_subject,
        ARRAY((SELECT DISTINCT value FROM metabib.full_rec WHERE tag = '651' AND subfield = 'a' AND record = r.id)) AS geographic_subject,
        ARRAY((SELECT DISTINCT value FROM metabib.full_rec WHERE tag = '655' AND subfield = 'a' AND record = r.id)) AS genre,