[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. 19d555a803052a398e665251eabaeb3aedb202a4

Evergreen Git git at git.evergreen-ils.org
Mon Oct 3 22:39:14 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, rel_2_1 has been updated
       via  19d555a803052a398e665251eabaeb3aedb202a4 (commit)
       via  9b8c9668d8e9e086c32e3df2d6234c4f01632970 (commit)
      from  effa4d715919f45dda4b7be8d9e3a92d7e5da3dd (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 19d555a803052a398e665251eabaeb3aedb202a4
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 98%
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 4ba626d..ab499ed 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,6 +1,8 @@
+-- Evergreen DB patch 0631.schema.located_uri_visiblity_fix.sql
+--
 BEGIN;
-
-INSERT INTO config.upgrade_log (version) VALUES ('XXXX'); -- miker
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0631', :eg_version);
 
 CREATE OR REPLACE FUNCTION search.query_parser_fts (
 

commit 9b8c9668d8e9e086c32e3df2d6234c4f01632970
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..4ba626d 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,37 +1,6 @@
-/*
- * 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;
-
 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 );
+INSERT INTO config.upgrade_log (version) VALUES ('XXXX'); -- miker
 
 CREATE OR REPLACE FUNCTION search.query_parser_fts (
 
@@ -51,6 +20,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 +52,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 +128,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

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

Summary of changes:
 Open-ILS/src/sql/Pg/300.schema.staged_search.sql   |   15 +++++++++++++-
 ...l => 0631.schema.located_uri_visiblity_fix.sql} |   21 +++++++++++++++++--
 2 files changed, 32 insertions(+), 4 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