From 0d026400d0356356e551bbb7265b4b0713792231 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 9 Nov 2009 02:04:47 +0000 Subject: [PATCH] Backport minimal fixes from r14825 and r14826 to address ISSN ingest and retrieval bugs git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4_0@14835 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm | 10 ++++++---- Open-ILS/src/sql/Pg/reporter-schema.sql | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm b/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm index 5756291b10..d0725535a8 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm @@ -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; diff --git a/Open-ILS/src/sql/Pg/reporter-schema.sql b/Open-ILS/src/sql/Pg/reporter-schema.sql index bd65b9dc83..660a1effae 100644 --- a/Open-ILS/src/sql/Pg/reporter-schema.sql +++ b/Open-ILS/src/sql/Pg/reporter-schema.sql @@ -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, -- 2.11.0