[open-ils-commits] r14468 - tags/rel_1_6_0_0/Open-ILS/src/sql/Pg (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Oct 15 23:56:45 EDT 2009
Author: dbs
Date: 2009-10-15 23:56:42 -0400 (Thu, 15 Oct 2009)
New Revision: 14468
Modified:
tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/030.schema.metabib.sql
tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql
tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Add a "complete subject" index and corresponding upgrade script
Modified: tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/030.schema.metabib.sql
===================================================================
--- tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/030.schema.metabib.sql 2009-10-16 01:57:55 UTC (rev 14467)
+++ tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/030.schema.metabib.sql 2009-10-16 03:56:42 UTC (rev 14468)
@@ -69,6 +69,7 @@
FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('subject');
CREATE INDEX metabib_subject_field_entry_index_vector_idx ON metabib.subject_field_entry USING GIST (index_vector);
+CREATE INDEX metabib_subject_field_entry_source_idx ON metabib.subject_field_entry (source);
CREATE TABLE metabib.keyword_field_entry (
Modified: tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql
===================================================================
--- tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql 2009-10-16 01:57:55 UTC (rev 14467)
+++ tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql 2009-10-16 03:56:42 UTC (rev 14468)
@@ -3930,8 +3930,46 @@
AFTER UPDATE ON biblio.record_entry
FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_bib_sync();
+-- Add a complete subject index
+INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES
+ ( 'subject', 'complete', 'mods32', $$//mods32:mods/mods32:subject//text()$$ );
+CREATE INDEX metabib_subject_field_entry_source_idx ON metabib.subject_field_entry (source);
+-- Insert all of the existing subject values into our new complete index
+INSERT INTO metabib.subject_field_entry (source, field, value)
+ SELECT source, (
+ SELECT id
+ FROM config.metabib_field
+ WHERE field_class = 'subject' AND name = 'complete'
+ ),
+ ARRAY_TO_STRING (
+ ARRAY (
+ SELECT value
+ FROM metabib.subject_field_entry msfe
+ WHERE msfe.source = groupee.source
+ ORDER BY source
+ ), ' '
+ ) AS grouped
+ FROM (
+ SELECT source
+ FROM metabib.subject_field_entry
+ GROUP BY source
+ ) AS groupee;
+
+-- Add values that weren't in the existing subject indices - primarily genres
+UPDATE metabib.subject_field_entry msfe SET value = msfe.value || ' ' || mfr.value
+ FROM metabib.full_rec mfr
+ WHERE tag LIKE '65%'
+ AND subfield = 'v'
+ AND mfr.record = msfe.source
+ AND field IN (
+ SELECT id
+ FROM config.metabib_field
+ WHERE field_class = 'subject'
+ AND name = 'complete'
+ );
+
---------!!!!!!!!!!!!!!!!!!!!!!---------------
-- Must go after COMMIT!!
---------!!!!!!!!!!!!!!!!!!!!!!---------------
Modified: tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-10-16 01:57:55 UTC (rev 14467)
+++ tags/rel_1_6_0_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-10-16 03:56:42 UTC (rev 14468)
@@ -43,6 +43,8 @@
-- ( field_class, name, xpath ) VALUES ( 'subject', 'genre', 'mods32', $$//mods32:mods/mods32:genre$$ );
INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES
( 'keyword', 'keyword', 'mods32', $$//mods32:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */;
+INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES
+ ( 'subject', 'complete', 'mods32', $$//mods32:mods/mods32:subject//text()$$ );
INSERT INTO config.non_cataloged_type ( id, owning_lib, name ) VALUES ( 1, 1, oils_i18n_gettext(1, 'Paperback Book', 'cnct', 'name') );
SELECT SETVAL('config.non_cataloged_type_id_seq'::TEXT, 100);
More information about the open-ils-commits
mailing list