[OPEN-ILS-DEV] Bib/Copy opac visibility
Josh Stompro
stomproj at gsuite.larl.org
Tue Mar 3 16:32:48 EST 2020
Thanks Jeff, that was very helpful. I'm just getting around to working on
updating our various scripts.
Using your second example, I came up with the following query to give me
all the OCLC numbers for titles that are currently opac visible for one
system in our consortium.
WITH c_attr AS (
SELECT
(ARRAY_TO_STRING(ARRAY[x.c_attrs,
search.calculate_visibility_attribute_test('circ_lib',(SELECT
(array_agg(id)) FROM actor.org_unit_descendants(101) WHERE id NOT IN
(143,141)),FALSE)],'&'))::query_int AS vis_test
FROM asset.patron_default_visibility_mask() x
)
SELECT SUBSTRING(mrfr.value FROM 'ocolc +(?:oc[nm]|on)?0*([0-9]*)')::BIGINT
AS oclc_num
,101 as parent_ou
FROM (SELECT DISTINCT vc.record
FROM asset.copy_vis_attr_cache vc,c_attr
WHERE
vc.vis_attr_vector @@ c_attr.vis_test ) recs
JOIN metabib.real_full_rec mrfr on mrfr.record=recs.record AND mrfr.tag =
'035' AND subfield = 'a' AND value LIKE 'ocolc %'
GROUP BY 1
ORDER BY 1
What is strange to me is that there is one record that shows up when I use
the following query, which gives me all the opac visible copies and filters
based on the circ lib outside of the cache. The one record doesn't show up
using the first query.
select SUBSTRING(mrfr.value FROM 'ocolc +(?:oc[nm]|on)?0*([0-9]*)')::BIGINT
AS oclc_num
,101 as parent_ou
FROM asset.copy_vis_attr_cache acvac
JOIN asset.copy acp ON acp.id=acvac.target_copy
join metabib.real_full_rec mrfr on mrfr.record=acvac.record AND mrfr.tag =
'035' AND subfield = 'a' AND value LIKE 'ocolc %'
WHERE acvac.vis_attr_vector @@ (
SELECT c_attrs::query_int
FROM asset.patron_default_visibility_mask() LIMIT 1 )
and acp.circ_lib in (SELECT id FROM actor.org_unit_descendants(101))
and circ_lib not in (143,141) --larl and nwrl cataloging
GROUP BY 1
ORDER BY 1
http://egcatalog.larl.org/eg/opac/record/335261
The only thing I can spot strange about it is that all the copies are In
Processing status, but that status is marked as opac_visible, so it should
be part of the default visibility rule. The record does show up in the
public catalog, and shows up in search results. The record has entries for
each copy in the asset.copy_vis_attr_cache. It was just edited an hour
ago, so maybe the cache just takes time to update?
It just makes me worried that I'm missing something with the logic.
Josh Stompro - LARL IT Director
-----Original Message-----
From: Open-ils-dev <open-ils-dev-bounces at list.georgialibraries.org> On
Behalf Of Jeff Davis
Sent: Thursday, June 06, 2019 12:47 PM
To: open-ils-dev at list.georgialibraries.org
Subject: Re: [OPEN-ILS-DEV] Bib/Copy opac visibility
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
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20200303/3a4af070/attachment.html>
More information about the Open-ils-dev
mailing list