Rather than reindexing all titles that have a non-filing indicator, this
upgrade handles the known problematic cases (apostrophes with leading
articles). On our system that's 55K out of 2.2M records - not bad at
all.
We also ensure the format is set to MODS32 for title:proper, as sites
might have customized it on a MARC basis and we don't want to reindex
the records with NULL values due to a mix of format and XPath.
Signed-off-by: Dan Scott <dscott@laurentian.ca>
-- but are you really going to read through the whole XSL below before
-- seeing this important bit?
UPDATE config.metabib_field
- SET xpath = $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$
+ SET xpath = $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$,
+ format = 'mods32'
WHERE field_class = 'title' AND name = 'proper';
UPDATE config.xml_transform SET xslt=$$<?xml version="1.0" encoding="UTF-8"?>
</xsl:stylesheet>$$ WHERE name = 'mods32';
COMMIT;
+
+-- This could take a long time if you have a very non-English bib database
+-- Run it outside of a transaction to avoid lock escalation
+SELECT metabib.reingest_metabib_field_entries(record)
+ FROM metabib.full_rec
+ WHERE tag = '245'
+ AND ind2 > '0'
+ AND subfield = 'a'
+ AND value LIKE '%''%'
+;