JBAS-2313 Authority index skip non-browse entries
authorBill Erickson <berickxx@gmail.com>
Mon, 15 Jul 2019 19:37:35 +0000 (15:37 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 16 Jul 2019 14:16:31 +0000 (10:16 -0400)
Avoid creating browse entry links to authority fields which are not
configured as browse_field's via their link to config.metabib_field
or have no link to metabib_field.  These entries will never appear in a
browse search and they prevent bib record ingest from completing as it
causes failures attempting to maintain the
metabib.browse_entry.metabib_fields_cache

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/sql/schema/deploy/stock-browse-schema.sql

index 2abd7be..96645bf 100644 (file)
@@ -677,6 +677,15 @@ BEGIN
         INSERT INTO authority.simple_heading (record,atag,value,sort_value,thesaurus)
         VALUES (ashs.record, ashs.atag, ashs.value, ashs.sort_value, ashs.thesaurus);
 
+        -- avoid creating browse entries for headings that are not linked
+        -- to browse=true metabib fields.
+        PERFORM 1 
+        FROM authority.control_set_auth_field_metabib_field_map_refs map
+        JOIN config.metabib_field cmf ON (cmf.id = map.metabib_field)
+        WHERE map.authority_field = ashs.atag AND cmf.browse_field;
+
+        CONTINUE WHEN NOT FOUND;
+
         ash_id := CURRVAL('authority.simple_heading_id_seq'::REGCLASS);
 
         SELECT INTO mbe_row * FROM metabib.browse_entry