[OPEN-ILS-DEV] Bib/Copy opac visibility

Jeff Davis jeff.davis at bc.libraries.coop
Thu Jun 6 13:46:34 EDT 2019


As an example, I think this should give you a list of all bib records 
with visible copies:

SELECT DISTINCT record
FROM asset.copy_vis_attr_cache
WHERE vis_attr_vector @@ (
     SELECT c_attrs::query_int
     FROM asset.patron_default_visibility_mask()
     LIMIT 1
);


If you want to limit yourself to records with copies that are visible at 
SYS1, you could pass a list of SYS1 and descendants (2, 4, 5, and 8) to 
search.calculate_visibility_attribute_test, like so:

WITH c_attr AS (
     SELECT (ARRAY_TO_STRING(ARRAY[
         c_attrs,
 
search.calculate_visibility_attribute_test('circ_lib','{2,4,5,8}',FALSE)
     ],'&'))::query_int AS vis_test
     FROM asset.patron_default_visibility_mask() x
)
SELECT COUNT(DISTINCT vc.record)
FROM asset.copy_vis_attr_cache vc, c_attr
WHERE vc.vis_attr_vector @@ c_attr.vis_test;


These queries don't include records that have located URIs but no 
physical copies.

Hope that helps!
Jeff


On 2019-06-06 8:07 a.m., Mike Rylander wrote:
> Hi Josh,
> 
> The short version is that you'll want to use the output of
> asset.patron_default_visibility_mask()'s c_attrs column to test the
> vis_attr_vector column of asset.copy_vis_attr_cache for copies
> attached to the records in question.  It gets more complicated if you
> want to check visibility of records at a specific location.  You can
> look at how the search query does that for more details.
> 
> (Short because I have to run, sorry! Hope that pointer is helpful to start.)
> 
> --
> Mike Rylander
>   | Executive Director
>   | Equinox Open Library Initiative
>   | phone:  1-877-OPEN-ILS (673-6457)
>   | email:  miker at equinoxinitiative.org
>   | web:  http://equinoxinitiative.org
> 
> On Thu, Jun 6, 2019 at 9:23 AM Josh Stompro <stomproj at exchange.larl.org> wrote:
>>
>> Hello, I just saw bug #1831803 [1] about removing asset.opac_visible_copies which jogged my memory that I need to change how our OCLC holdings update scripts work in the future.
>>
>>
>>
>> Does anyone know if there is a write up/conference presentation on how the asset visiblility / biblio.record_entry.vis_attr_vector stuff works?  I want to select all bib records of physical items that show up in the catalog for the public by default.
>>
>>
>>
>> Thanks
>>
>> Josh
>>
>>
>>
>>
>>
>> 1 - https://bugs.launchpad.net/evergreen/+bug/1831803
>>
>>
>>
>>
>>
>> Lake Agassiz Regional Library - Moorhead MN larl.org
>>
>> Josh Stompro     | Office 218.233.3757 EXT-139
>>
>> LARL IT Director | Cell 218.790.2110
>>
>>


More information about the Open-ils-dev mailing list