[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. 58845f8a32dbf95c84a44d3d77538db9ac4782f0
Evergreen Git
git at git.evergreen-ils.org
Thu Aug 22 12:20:56 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_3 has been updated
via 58845f8a32dbf95c84a44d3d77538db9ac4782f0 (commit)
via 2f135e6d21c13a3c5ce013343e0991369f3f9624 (commit)
from 99cc0c0fe9550f5d0731f042df8341de46ed1198 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 58845f8a32dbf95c84a44d3d77538db9ac4782f0
Author: Ben Shum <bshum at biblio.org>
Date: Thu Aug 22 12:11:54 2013 -0400
Stamping upgrade for browse normalization timing fix
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 0919d76..dff1437 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0820', :eg_version); -- callender/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0821', :eg_version); -- miker/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.browse-normalize-timing.sql b/Open-ILS/src/sql/Pg/upgrade/0821.function.browse-normalize-timing.sql
similarity index 97%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.browse-normalize-timing.sql
rename to Open-ILS/src/sql/Pg/upgrade/0821.function.browse-normalize-timing.sql
index bb9cc5e..25a5db3 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.browse-normalize-timing.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0821.function.browse-normalize-timing.sql
@@ -1,6 +1,6 @@
BEGIN;
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0821', :eg_version);
CREATE OR REPLACE FUNCTION metabib.reingest_metabib_field_entries( bib_id BIGINT, skip_facet BOOL DEFAULT FALSE, skip_browse BOOL DEFAULT FALSE, skip_search BOOL DEFAULT FALSE ) RETURNS VOID AS $func$
DECLARE
commit 2f135e6d21c13a3c5ce013343e0991369f3f9624
Author: Mike Rylander <mrylander at gmail.com>
Date: Tue Aug 20 16:00:48 2013 -0400
Browse normalization timing fix
When indexing browse entries, we need to normalize the value we want to use
before we go looking for it in the table, for uniqueness. We do in master,
we need to in 2.3 as well.
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/030.schema.metabib.sql b/Open-ILS/src/sql/Pg/030.schema.metabib.sql
index e833ef2..264e4e6 100644
--- a/Open-ILS/src/sql/Pg/030.schema.metabib.sql
+++ b/Open-ILS/src/sql/Pg/030.schema.metabib.sql
@@ -479,6 +479,7 @@ DECLARE
ind_data metabib.field_entry_template%ROWTYPE;
mbe_row metabib.browse_entry%ROWTYPE;
mbe_id BIGINT;
+ mbe_txt TEXT;
BEGIN
PERFORM * FROM config.internal_flag WHERE name = 'ingest.assume_inserts_only' AND enabled;
IF NOT FOUND THEN
@@ -513,12 +514,12 @@ BEGIN
-- evergreen.oils_tsearch2()) changes. It may or may not be
-- expensive to add a comparison of index_vector to index_vector
-- to the WHERE clause below.
- SELECT INTO mbe_row * FROM metabib.browse_entry WHERE value = ind_data.value;
+ mbe_txt := metabib.browse_normalize(ind_data.value, ind_data.field);
+ SELECT INTO mbe_row * FROM metabib.browse_entry WHERE value = mbe_txt;
IF FOUND THEN
mbe_id := mbe_row.id;
ELSE
- INSERT INTO metabib.browse_entry (value) VALUES
- (metabib.browse_normalize(ind_data.value, ind_data.field));
+ INSERT INTO metabib.browse_entry (value) VALUES (mbe_txt);
mbe_id := CURRVAL('metabib.browse_entry_id_seq'::REGCLASS);
END IF;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.browse-normalize-timing.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.browse-normalize-timing.sql
new file mode 100644
index 0000000..bb9cc5e
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.browse-normalize-timing.sql
@@ -0,0 +1,76 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION metabib.reingest_metabib_field_entries( bib_id BIGINT, skip_facet BOOL DEFAULT FALSE, skip_browse BOOL DEFAULT FALSE, skip_search BOOL DEFAULT FALSE ) RETURNS VOID AS $func$
+DECLARE
+ fclass RECORD;
+ ind_data metabib.field_entry_template%ROWTYPE;
+ mbe_row metabib.browse_entry%ROWTYPE;
+ mbe_id BIGINT;
+ mbe_txt TEXT;
+BEGIN
+ PERFORM * FROM config.internal_flag WHERE name = 'ingest.assume_inserts_only' AND enabled;
+ IF NOT FOUND THEN
+ IF NOT skip_search THEN
+ FOR fclass IN SELECT * FROM config.metabib_class LOOP
+ -- RAISE NOTICE 'Emptying out %', fclass.name;
+ EXECUTE $$DELETE FROM metabib.$$ || fclass.name || $$_field_entry WHERE source = $$ || bib_id;
+ END LOOP;
+ END IF;
+ IF NOT skip_facet THEN
+ DELETE FROM metabib.facet_entry WHERE source = bib_id;
+ END IF;
+ IF NOT skip_browse THEN
+ DELETE FROM metabib.browse_entry_def_map WHERE source = bib_id;
+ END IF;
+ END IF;
+
+ FOR ind_data IN SELECT * FROM biblio.extract_metabib_field_entry( bib_id ) LOOP
+ IF ind_data.field < 0 THEN
+ ind_data.field = -1 * ind_data.field;
+ END IF;
+
+ IF ind_data.facet_field AND NOT skip_facet THEN
+ INSERT INTO metabib.facet_entry (field, source, value)
+ VALUES (ind_data.field, ind_data.source, ind_data.value);
+ END IF;
+
+ IF ind_data.browse_field AND NOT skip_browse THEN
+ -- A caveat about this SELECT: this should take care of replacing
+ -- old mbe rows when data changes, but not if normalization (by
+ -- which I mean specifically the output of
+ -- evergreen.oils_tsearch2()) changes. It may or may not be
+ -- expensive to add a comparison of index_vector to index_vector
+ -- to the WHERE clause below.
+ mbe_txt := metabib.browse_normalize(ind_data.value, ind_data.field);
+ SELECT INTO mbe_row * FROM metabib.browse_entry WHERE value = mbe_txt;
+ IF FOUND THEN
+ mbe_id := mbe_row.id;
+ ELSE
+ INSERT INTO metabib.browse_entry (value) VALUES (mbe_txt);
+ mbe_id := CURRVAL('metabib.browse_entry_id_seq'::REGCLASS);
+ END IF;
+
+ INSERT INTO metabib.browse_entry_def_map (entry, def, source)
+ VALUES (mbe_id, ind_data.field, ind_data.source);
+ END IF;
+
+ IF ind_data.search_field AND NOT skip_search THEN
+ EXECUTE $$
+ INSERT INTO metabib.$$ || ind_data.field_class || $$_field_entry (field, source, value)
+ VALUES ($$ ||
+ quote_literal(ind_data.field) || $$, $$ ||
+ quote_literal(ind_data.source) || $$, $$ ||
+ quote_literal(ind_data.value) ||
+ $$);$$;
+ END IF;
+
+ END LOOP;
+
+ RETURN;
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;
+
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/030.schema.metabib.sql | 7 ++++---
...l => 0821.function.browse-normalize-timing.sql} | 14 ++++++--------
3 files changed, 11 insertions(+), 12 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{0711.schema.reingest_avoid_collision_better.sql => 0821.function.browse-normalize-timing.sql} (91%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list