From ef39a4a52462ad572e489e6a16b5f3489f5657f8 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 9 Aug 2011 15:30:56 -0400 Subject: [PATCH] lp 823496: don't fail to index personal names that have relators The default definition for the author|other index inadvertantly excluded names from 600, 700, 720, and 800 fields that have relator values ($e) or codes ($4). Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 2 +- .../sql/Pg/upgrade/XXXX.fix_author_other_index.sql | 28 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.fix_author_other_index.sql diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 1720b8c9be..7f50cdbb44 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -56,7 +56,7 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field ) VALUES (9, 'author', 'conference', oils_i18n_gettext(9, 'Conference Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='conference' and mods32:role/mods32:roleTerm[text()='creator']]$$, $$//*[local-name()='namePart']$$, TRUE ); -- /* to fool vim */; INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field ) VALUES - (10, 'author', 'other', oils_i18n_gettext(10, 'Other Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='personal' and not(mods32:role)]$$, $$//*[local-name()='namePart']$$, TRUE ); -- /* to fool vim */; + (10, 'author', 'other', oils_i18n_gettext(10, 'Other Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='personal' and not(mods32:role/mods32:roleTerm[text()='creator'])]$$, $$//*[local-name()='namePart']$$, TRUE ); -- /* to fool vim */; INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES (11, 'subject', 'geographic', oils_i18n_gettext(11, 'Geographic Subject', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:subject/mods32:geographic$$, TRUE ); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_author_other_index.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_author_other_index.sql new file mode 100644 index 0000000000..41d65f8dd7 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_author_other_index.sql @@ -0,0 +1,28 @@ +-- Evergreen DB patch XXXX.fix_author_other_index.sql +-- +-- Fix author|other index so that it doesn't exclude 700 +-- fields that contain relator values in the $e or $4. +-- +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +UPDATE config.metabib_field +SET xpath = $$//mods32:mods/mods32:name[@type='personal' and not(mods32:role/mods32:roleTerm[text()='creator'])]$$ +WHERE field_class = 'author' +AND name = 'other' +AND xpath = $$//mods32:mods/mods32:name[@type='personal' and not(mods32:role)]$$ +AND format = 'mods32'; + +-- To reindex the affected bibs, you can run something like this: +-- +-- SELECT metabib.reingest_metabib_field_entries(record) +-- FROM ( +-- SELECT DISTINCT record +-- FROM metabib.real_full_rec +-- WHERE tag IN ('600', '700', '720', '800') +-- AND subfield IN ('4', 'e') +-- ) a; + +COMMIT; -- 2.11.0