[open-ils-commits] [GIT] Evergreen ILS branch master updated. c8af163c565cab39ea10e832b0ca459fb82fdbf0

Evergreen Git git at git.evergreen-ils.org
Mon Oct 3 22:36:13 EDT 2011


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, master has been updated
       via  c8af163c565cab39ea10e832b0ca459fb82fdbf0 (commit)
       via  ba47ecc6196055886ad6f23284819be5dec8448d (commit)
      from  0e9dab142d4cd6eabc395a01971eeef1005e50c3 (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 c8af163c565cab39ea10e832b0ca459fb82fdbf0
Author: Dan Scott <dscott at laurentian.ca>
Date:   Mon Oct 3 22:34:47 2011 -0400

    LP865817: Fix Located URI visibility test
    
    Wrapped upgrade script for LP865817.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.located_uri_visiblity_fix.sql b/Open-ILS/src/sql/Pg/upgrade/0631.schema.located_uri_visiblity_fix.sql
similarity index 97%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.located_uri_visiblity_fix.sql
rename to Open-ILS/src/sql/Pg/upgrade/0631.schema.located_uri_visiblity_fix.sql
index 3b44212..b5843db 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.located_uri_visiblity_fix.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0631.schema.located_uri_visiblity_fix.sql
@@ -1,14 +1,9 @@
--- Evergreen DB patch XXXX.schema.located_uri_visiblity_fix.sql
---
--- FIXME: insert description of change, if needed
+-- Evergreen DB patch 0631.schema.located_uri_visiblity_fix.sql
 --
 BEGIN;
-
-
 -- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0631', :eg_version);
 
--- FIXME: add/check SQL statements to perform the upgrade
 CREATE OR REPLACE FUNCTION search.query_parser_fts (
 
     param_search_ou INT,
@@ -328,6 +323,4 @@ BEGIN
 END;
 $func$ LANGUAGE PLPGSQL;
 
-
-
 COMMIT;

commit ba47ecc6196055886ad6f23284819be5dec8448d
Author: Mike Rylander <mrylander at gmail.com>
Date:   Mon Oct 3 15:01:26 2011 -0400

    Correct Located URI visiblity
    
    Located URIs should be visible when they exist at the search context org unit
    or an ancestor thereof.  However, before the change embodied in this commit,
    they effectively acted exactly like copies, making records visible anywhere
    within the context+depth range.
    
    An example, using the stock example OU hierarchy:
    
     * Before this change, a Located URI with an owner of BR1 would cause its
    record to show up in a search at (or scoped to via a depth parameter) BR1,
    SYS1 or CONS.
    
     * Before this change, a Located URI with an owner of SYS1 would NOT cause its
    record to show up in a search at (or scoped to via a depth parameter) BR1!
    
     * After this change, a Located URI with an owner of BR1 will cause its record
    to show up only in a search with a context OU of BR1, irrespective of depth
    scoping.
    
     * After this change, a Located URI with an owner of SYS1 WILL cause its
    record to show up in a search with a context OU of BR1 or SYS1, regardless of
    depth scoping.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
index ebea8cd..9f23e17 100644
--- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
+++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
@@ -51,6 +51,8 @@ DECLARE
 
     current_res         search.search_result%ROWTYPE;
     search_org_list     INT[];
+    luri_org_list       INT[];
+    tmp_int_list        INT[];
 
     check_limit         INT;
     core_limit          INT;
@@ -81,8 +83,19 @@ BEGIN
         ELSE
             SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou );
         END IF;
+
+        SELECT array_accum(distinct id) INTO luri_org_list FROM actor.org_unit_ancestors( param_search_ou );
+
     ELSIF param_search_ou < 0 THEN
         SELECT array_accum(distinct org_unit) INTO search_org_list FROM actor.org_lasso_map WHERE lasso = -param_search_ou;
+
+        FOR tmp_int IN SELECT * FROM UNNEST(search_org_list) LOOP
+            SELECT array_accum(distinct id) INTO tmp_int_list FROM actor.org_unit_ancestors( tmp_int );
+            luri_org_list := luri_org_list || tmp_int_list;
+        END LOOP;
+
+        SELECT array_accum(DISTINCT x.id) INTO luri_org_list FROM UNNEST(luri_org_list) x(id);
+
     ELSIF param_search_ou = 0 THEN
         -- reserved for user lassos (ou_buckets/type='lasso') with ID passed in depth ... hack? sure.
     END IF;
@@ -146,7 +159,7 @@ BEGIN
                 AND uri.active
                 AND ( param_locations IS NULL OR array_upper(param_locations, 1) IS NULL )
                 AND cn.record IN ( SELECT * FROM unnest( core_result.records ) )
-                AND cn.owning_lib IN ( SELECT * FROM unnest( search_org_list ) )
+                AND cn.owning_lib IN ( SELECT * FROM unnest( luri_org_list ) )
           LIMIT 1;
 
         IF FOUND THEN
diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.located_uri_visiblity_fix.sql
similarity index 88%
copy from Open-ILS/src/sql/Pg/300.schema.staged_search.sql
copy to Open-ILS/src/sql/Pg/upgrade/XXXX.schema.located_uri_visiblity_fix.sql
index ebea8cd..3b44212 100644
--- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.located_uri_visiblity_fix.sql
@@ -1,38 +1,14 @@
-/*
- * Copyright (C) 2007-2010  Equinox Software, Inc.
- * Mike Rylander <miker at esilibrary.com> 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-
-DROP SCHEMA IF EXISTS search CASCADE;
-
+-- Evergreen DB patch XXXX.schema.located_uri_visiblity_fix.sql
+--
+-- FIXME: insert description of change, if needed
+--
 BEGIN;
 
-CREATE SCHEMA search;
-
-CREATE TABLE search.relevance_adjustment (
-    id          SERIAL  PRIMARY KEY,
-    active      BOOL    NOT NULL DEFAULT TRUE,
-    field       INT     NOT NULL REFERENCES config.metabib_field (id) DEFERRABLE INITIALLY DEFERRED,
-    bump_type   TEXT    NOT NULL CHECK (bump_type IN ('word_order','first_word','full_match')),
-    multiplier  NUMERIC NOT NULL DEFAULT 1.0
-);
-CREATE UNIQUE INDEX bump_once_per_field_idx ON search.relevance_adjustment ( field, bump_type );
 
-CREATE TYPE search.search_result AS ( id BIGINT, rel NUMERIC, record INT, total INT, checked INT, visible INT, deleted INT, excluded INT );
-CREATE TYPE search.search_args AS ( id INT, field_class TEXT, field_name TEXT, table_alias TEXT, term TEXT, term_type TEXT );
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
 
+-- FIXME: add/check SQL statements to perform the upgrade
 CREATE OR REPLACE FUNCTION search.query_parser_fts (
 
     param_search_ou INT,
@@ -51,6 +27,8 @@ DECLARE
 
     current_res         search.search_result%ROWTYPE;
     search_org_list     INT[];
+    luri_org_list       INT[];
+    tmp_int_list        INT[];
 
     check_limit         INT;
     core_limit          INT;
@@ -81,8 +59,19 @@ BEGIN
         ELSE
             SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou );
         END IF;
+
+        SELECT array_accum(distinct id) INTO luri_org_list FROM actor.org_unit_ancestors( param_search_ou );
+
     ELSIF param_search_ou < 0 THEN
         SELECT array_accum(distinct org_unit) INTO search_org_list FROM actor.org_lasso_map WHERE lasso = -param_search_ou;
+
+        FOR tmp_int IN SELECT * FROM UNNEST(search_org_list) LOOP
+            SELECT array_accum(distinct id) INTO tmp_int_list FROM actor.org_unit_ancestors( tmp_int );
+            luri_org_list := luri_org_list || tmp_int_list;
+        END LOOP;
+
+        SELECT array_accum(DISTINCT x.id) INTO luri_org_list FROM UNNEST(luri_org_list) x(id);
+
     ELSIF param_search_ou = 0 THEN
         -- reserved for user lassos (ou_buckets/type='lasso') with ID passed in depth ... hack? sure.
     END IF;
@@ -146,7 +135,7 @@ BEGIN
                 AND uri.active
                 AND ( param_locations IS NULL OR array_upper(param_locations, 1) IS NULL )
                 AND cn.record IN ( SELECT * FROM unnest( core_result.records ) )
-                AND cn.owning_lib IN ( SELECT * FROM unnest( search_org_list ) )
+                AND cn.owning_lib IN ( SELECT * FROM unnest( luri_org_list ) )
           LIMIT 1;
 
         IF FOUND THEN
@@ -339,5 +328,6 @@ BEGIN
 END;
 $func$ LANGUAGE PLPGSQL;
 
-COMMIT;
 
+
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/300.schema.staged_search.sql   |   15 +++++++++++-
 ...l => 0631.schema.located_uri_visiblity_fix.sql} |   24 +++++++++++++------
 2 files changed, 30 insertions(+), 9 deletions(-)
 copy Open-ILS/src/sql/Pg/upgrade/{0573.schema.staff_search_find_no_copies.sql => 0631.schema.located_uri_visiblity_fix.sql} (93%)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list