From 2909f660c48f4a12904b03af80c65828f3ce180a Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Tue, 30 Oct 2012 12:08:54 -0400 Subject: [PATCH] Index corporate authors based on relator codes The existing stock index for corporate authors only kicks in if the 710 subfield 'e' == 'creator', but relator codes (in subfield '4') are by many accounts a preferred mode of identifying the relationship of an added entry. Thus, add '4' == ('aut' or 'cre') to the criteria for indexing a corporate author. Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 2 +- .../Pg/upgrade/XXXX.data.index_corporate_authors.sql | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.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 e89a2e84b6..9f2c2f2805 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -123,7 +123,7 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath ) (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$ ); INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field ) VALUES - (7, 'author', 'corporate', oils_i18n_gettext(7, 'Corporate Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='corporate' and mods32:role/mods32:roleTerm[text()='creator']]$$, $$//*[local-name()='namePart']$$, TRUE ); -- /* to fool vim */; + (7, 'author', 'corporate', oils_i18n_gettext(7, 'Corporate Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='corporate' and (mods32:role/mods32:roleTerm[text()='creator'] or mods32:role/mods32:roleTerm[text()='aut'] or mods32:role/mods32:roleTerm[text()='cre'])]$$, $$//*[local-name()='namePart']$$, TRUE ); -- /* to fool vim */; INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field ) VALUES (8, 'author', 'personal', oils_i18n_gettext(8, 'Personal Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='personal' 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 diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql new file mode 100644 index 0000000000..ff41992672 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql @@ -0,0 +1,18 @@ +-- Use MARC relator codes (710 subfield 4) to index corporate authors, along +-- with the existing relator text (710 subfield e) + +UPDATE config.metabib_field + SET xpath = $$//mods32:mods/mods32:name[@type='corporate' + and (mods32:role/mods32:roleTerm[text()='creator'] + or mods32:role/mods32:roleTerm[text()='aut'] + or mods32:role/mods32:roleTerm[text()='cre'] + )]$$ + WHERE id = 7 +; + +SELECT metabib.reingest_metabib_field_entries(record, TRUE, TRUE, FALSE) + FROM metabib.full_rec + WHERE tag = '710' + AND subfield = '4' + AND value IN ('cre', 'aut') +; -- 2.11.0