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

Bug #1791791 reported by Eva Cerninakova
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.9
Fix Released
Medium
Unassigned
Revision history for this message
tji@sitka.bclibraries.ca (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

Revision history for this message
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
Revision history for this message
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:
https://spok.jabok.cuni.cz/eg/opac/record/30492?detail_record_view=0;fi%3Aitem_lang=eng;fi%3Abib_level=m;locg=1;pubdate=is

Revision history for this message
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:

https://spok.jabok.cuni.cz/eg/opac/record/30492?query=ment%C3%A1ln%C3%AD%20posti%C5%BEen%C3%AD%20valenta;qtype=keyword;locg=1;detail_record_view=0

When the URL is manually changed to:

https://spok.jabok.cuni.cz/eg/opac/record/30492?qtype=keyword;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?

Revision history for this message
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 ctx.page == '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 ctx.page == 'record' represent all records (even those to which one gets from search results)?

Revision history for this message
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:

https://git.evergreen-ils.org/?p=Evergreen.git;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.

Revision history for this message
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.

Revision history for this message
tji@sitka.bclibraries.ca (tji) wrote :

Still an issue on 3.3.3.

tags: removed: webstaffclient
Revision history for this message
Linda Jansova (skolkova-s) wrote :

I can confirm that the issue still persists in 3.6.4.

We have tried to comment this piece of CSS (in /templates/opac/css/style.css.tt2) but unfortunately it hasn't been much of a help:

#gbp_extra, #gbp_arrow_down_link {
display: none;
}

What is also different between the pages where the previews work and the pages where they don't is that the latter do have the rdetail_header part included.

What should be changed to make the Google Books Previews work when users get to the record pages directly from search results (this being probably the most common scenario of all) remains a mystery, though.

Revision history for this message
Garry Collum (gcollum) wrote :

A proposed patch is here. https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=bfe0d8f01b087867320692c3ba01138b3810c566

It has to do with how that ISBNs are rendered. With the ;query string in the URI the ISBNs are rendered like this.

<ul>
    <li class='rdetail_isbns'>
        <strong class='rdetail_label'>ISBN:</strong> 978-80-271-0378-2

Without the ;query string they are rendered like this:

<ul>
    <li class='rdetail_isbns'>
        <strong class='rdetail_label'>ISBN:</strong>
        <span class='rdetail_value' property='isbn'>978-80-271-0378-2</span>

The javascript that queries google is looking for the ISBN value the 'rdetail_value' class.

There are two variables in the code that render the ISBN value. One was wrapped in a <span> assigned the rdetail_value class and the other was not. The patch just fixes the one that was not assigned that class. I really don't know why adding ';query' to the URL favors one ISBN variable over the other.

tags: added: pullrequest
Revision history for this message
Galen Charlton (gmc) wrote :

Noting that this is the TPAC version of bug 1955403.

Revision history for this message
Galen Charlton (gmc) wrote :

Signoff pushed to user/gmcharlt/lp1791791_signoff. The branch includes two follow-ups to deal with regressions on bug 1923225.

Changed in evergreen:
milestone: none → 3.10.2
importance: Undecided → Medium
tags: added: signedoff
Revision history for this message
Galen Charlton (gmc) wrote :

Enough time has passed and the impact is minimal, so I've pushed this down to rel_3_9. Thanks, Garry!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.