]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0599.data.fix_author_other_index.sql
LP#1772955: Only include xacts with balance in summary
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0599.data.fix_author_other_index.sql
1 -- Evergreen DB patch XXXX.fix_author_other_index.sql
2 --
3 -- Fix author|other index so that it doesn't exclude 700
4 -- fields that contain relator values in the $e or $4.
5 --
6 BEGIN;
7
8 -- check whether patch can be applied
9 SELECT evergreen.upgrade_deps_block_check('0599', :eg_version);
10
11 UPDATE config.metabib_field 
12 SET xpath = $$//mods32:mods/mods32:name[@type='personal' and not(mods32:role/mods32:roleTerm[text()='creator'])]$$
13 WHERE field_class = 'author'
14 AND name = 'other'
15 AND xpath = $$//mods32:mods/mods32:name[@type='personal' and not(mods32:role)]$$
16 AND format = 'mods32';
17
18 -- To reindex the affected bibs, you can run something like this:
19 --
20 -- SELECT metabib.reingest_metabib_field_entries(record)
21 -- FROM (
22 --   SELECT DISTINCT record
23 --   FROM metabib.real_full_rec
24 --   WHERE tag IN ('600', '700', '720', '800')
25 --   AND   subfield IN ('4', 'e')
26 -- ) a;
27
28 COMMIT;