Google books previews dont show up when link to the bib record comes from the search results page

Bug #1791791 reported by Eva Cerninakova on 2018-09-10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Unassigned (tji) wrote :

I see this behaivour on both 3.0.4 and 3.1.4. Google Preview shows up if you search by record id, does not show up if searching by title and other bib info.

Tina Ji

Christine Morgan (cmorgan-z) wrote :

Still present in 3.2 beta 1. The same problem exists in the web client except that when you reload the page, the Google Preview button appears. Reloading the page in the public catalog, however, does not restore the button.

Changed in evergreen:
status: New → Confirmed
tags: added: addedcontent opac webstaffclient
Eva Cerninakova (ece) wrote :

Additional observance from our production catalog (3.1.4). When a search is performed using just advanced search filters, e.g., by language and bibliographic level, the Google Preview buttons shows up in the record. For example:;fi%3Aitem_lang=eng;fi%3Abib_level=m;locg=1;pubdate=is

Linda Jansova (skolkova-s) wrote :

It seems to me that it is the query part of the URL (e.g., "query=mentální postižení valenta;") that prevents the previews from showing up.

When I search for mentální postižení valenta in our catalog, one of the results is the record Eva has mentioned:;qtype=keyword;locg=1;detail_record_view=0

When the URL is manually changed to:;locg=1;detail_record_view=0

(meaning that "query=mentální postižení valenta;" is omitted),

the preview does show up.

Could that help in determining the underlying cause of the problem?

Linda Jansova (skolkova-s) wrote :

It appears that Google Books previews are displayed via ac_google_books.js which is linked from templates/opac/parts/js.tt2:

[%- IF == 'record' AND ctx.google_books_preview %]
<script src='[% ctx.media_prefix %]/js/ui/default/opac/ac_google_books.js[% ctx.cache_key %]' async defer></script>
[%- END %]

Just thinking aloud - does == 'record' represent all records (even those to which one gets from search results)?

Linda Jansova (skolkova-s) wrote :

I have also noticed that line 63 in Open-ILS/src/templates/opac/parts/js.tt2):

<script src='[% ctx.media_prefix %]/js/ui/default/opac/ac_google_books.js' async defer></script>

does not include "type="text/javascript" like all the other occurrences of links to external javascript files do.

Could that cause any problem?

The link to the JavaScript file was added in 2017:;a=blobdiff;f=Open-ILS/src/templates/opac/parts/js.tt2;h=f7fc737754b02c95c1274c72ae0c713719a91fa8;hp=1deac9143452b2aec703c9a03802480a3791996b;hb=55aa6265712b38eb746aa69c5ea93702d1b6950c;hpb=07466251f2c0d60a5c6aaebb23c87d5cf26c7f02

I am not entirely sure when exactly the preview started not to show up properly but - given the fact that we usually upgrade our installs in summer - it seems likely that the changes made in May 2017 may have given rise to the problem.

Linda Jansova (skolkova-s) wrote :

I have also noticed that in:

<script src='[% ctx.media_prefix %]/js/ui/default/opac/ac_google_books.js' async defer></script>

single quotes are used while in other cases double quotes - like src="something" - prevail.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers