(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
--- /dev/null
+-- 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')
+;