[open-ils-commits] r14250 - in trunk/Open-ILS/src/sql/Pg: . upgrade (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Oct 2 02:04:38 EDT 2009
Author: dbs
Date: 2009-10-02 02:04:34 -0400 (Fri, 02 Oct 2009)
New Revision: 14250
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0030.data.flat-subject-entries.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Add a "complete subject" index to support searches of compound subjects composed of topic + temporal + geographic headings
Prior to this patch, searches for compound subjects had to be targeted against the keywords index
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-10-02 04:53:32 UTC (rev 14249)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-10-02 06:04:34 UTC (rev 14250)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0029'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0030'); -- dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-10-02 04:53:32 UTC (rev 14249)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-10-02 06:04:34 UTC (rev 14250)
@@ -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);
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0030.data.flat-subject-entries.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0030.data.flat-subject-entries.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0030.data.flat-subject-entries.sql 2009-10-02 06:04:34 UTC (rev 14250)
@@ -0,0 +1,32 @@
+BEGIN;
+
+-- Generate the equivalent of compound subject entries from the existing rows
+-- so that we don't have to laboriously reindex them
+
+INSERT INTO config.upgrade_log (version) VALUES ('0030'); -- dbs
+
+INSERT INTO config.metabib_field (field_class, name, format, xpath ) VALUES
+ ( 'subject', 'complete', 'mods32', $$//mods32:mods/mods32:subject//text()$$ );
+
+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
+ ORDER BY source;
+
+COMMIT;
More information about the open-ils-commits
mailing list