Bug 5842 - Cross-Reference links to authorized fields give incomplete search results
Summary: Cross-Reference links to authorized fields give incomplete search results
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: 3.4
Hardware: All All
: P5 - low normal
Assignee: Galen Charlton
QA Contact: Bugs List
URL:
Keywords:
Depends on: 5810
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-08 16:41 UTC by Jane Wagner
Modified: 2015-12-03 22:00 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
patch file for OPAC XSLT and syspref fix (18.80 KB, patch)
2011-03-08 16:44 UTC, Jane Wagner
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jane Wagner 2011-03-08 16:41:55 UTC
The end-result problem is that clicking on cross-reference links in OPAC or staff XSLT title displays (authors, subjects) can produce incomplete results.  The underlying problem is fairly complex.  (Kudos to Bev Church for doing a lot of the in-depth research.)

At the moment, there is only one system preference that controls authority creation -- BiblioAddsAuthorities.

If you set the preference to OFF, staff cannot enter data in any authority controlled subfield.

o	Staff must first create an authority record and then link it to the bibliographic record if they manually create a bibliographic record. This is not a viable option for a lot of sites; they do not want to work with authority records or don't have the knowledge to create and then link a record.

o	Koha does no automatic bib/authority linking or authority creation if bibliographic records are imported using Z39.50 and the MARC import tool.



If you set the preference to ON, staff can enter data in any authority controlled subfield.

o	Koha does automatic bib/authority linking and authority creation if bibliographic records are manually added or imported using Z39.50.

o	Koha does NO automatic bib/authority linking and authority creation if bibliographic records are added using the MARC import tool.



With BiblioAddsAuthorities on, if a site does batch imports, the end result is that some authority controlled tags in their bibliographic records are linked to authority records while others are not. This affects the way Koha retrieves titles when users/staff click on the authority links in the full bibliographic record due to a searching enhancement. 

As it stands, the XSLT for both staff and OPAC checks for any authority record number in subfield $9 of authority controlled tags (the various author and subject fields) in the bibliographic record. If one exists, Koha uses the authority number as the search parameter instead of the name/subject string itself.  For example, in an OPAC XSLT title record display, clicking on the author or one of the subjects will search against the titles linked to the authority record, not the equivalent author or subject zebra index.  The search results may not be complete -- there are most probably fewer hits than if the search was done as a zebra title or subject search.

See the following difference in how those cross-reference search links are formed with and without the link to the authority record:

http://myserver/cgi-bin/koha/opac-search.pl?q=an:37
http://myserver/cgi-bin/koha/opac-search.pl?q=au:Carroll,%20Jonathan,



http://myserver/cgi-bin/koha/opac-search.pl?q=an:38
http://myserver/cgi-bin/koha/opac-search.pl?q=su:Children%27s%20stories


The most complete fix would be to modify the batch import tool to create the brief authority records, and do some substantial work on linking and merging authority records.

I don't have the skill to do that, but I came up with a partial lipstick-on-a-pig solution.  I created a system preference called CrossRefsUseAuthorities with this description:

"If on, author and subject cross-references from title displays will use authority record to find related titles in staff and OPAC XSLT title display. If off, forces author and subject cross-reference searches to use the zebra indexes rather than the authority indexes; needed when BiblioAddsAuthorities is on but not all records have authorities (or there are multiple authority records). In that situation, a cross-reference search on the authority entry will not retrieve all titles."

This tested and worked OK for OPAC XSLT, but I could not make it work for staff XSLT.  The problem there seems to be that the part of C4/XSLT.pm which passes variables to the XSLT stylesheet is not being obeyed:

    foreach my $syspref ( qw/OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText viewISBD OPACBaseURL CrossRefsUseAuthorities/ ) {

Therefore, when I tried to modify the staff XSLT files similar to the change I did in the OPAC XSLT files:

        <xsl:choose>
            <xsl:when test="marc:subfield[@code=9] and $CrossRefsUseAuthorities!='0'">
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
            </xsl:when>
            <xsl:otherwise>
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
            </xsl:otherwise>
        </xsl:choose>



I got error messages about invalid variables from trying to use the system preference.

I don't know how to fix that problem.  I am attaching a patch file for the part that I do have working (the syspref and the OPAC XSLT files).  Can someone test those?  Any takers to (a) solve the staff XSLT problem and/or (b) solve the underlying problem of authorities not being created with imports?
Comment 1 Jane Wagner 2011-03-08 16:44:59 UTC Comment hidden (obsolete)
Comment 2 Jane Wagner 2011-03-08 16:57:45 UTC
Per discussion on the IRC, Jared's patch on Bug 5810 would probably solve this problem as well.
Comment 3 Jane Wagner 2011-03-08 18:05:06 UTC
The revised patches on Bug 5810 solve the immediate problem -- searches can be made to use the zebra index instead of the authority record.  However, the underlying problem remains:  batch importing bib records does not create the brief authority records.  Therefore, I'm leaving this bug report open.
Comment 4 Jared Camins-Esakov 2012-02-12 20:22:08 UTC
Comment on attachment 3268 [details] [review]
patch file for OPAC XSLT and syspref fix

UseAuthoritiesForTracings already provides this feature in Master and 3.6.
Comment 5 Katrin Fischer 2015-01-06 17:45:06 UTC
Marking resolved fixed as of Jared's comment#4