Bug 26679

Summary: Genre tags linking to subject search, causing null results
Product: Koha Reporter: Craig <cbutosi>
Component: SearchingAssignee: Andrew Fuerste-Henry <andrew>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: andrew, fridolin.somers, heather_hernandez, kyle, martin.renvoize, rhouk, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05,20.05.11
Attachments: Bug 26679: Use index-term-genre for 655
Bug 26679: Use index-term-genre for 655
Bug 26679: Use index-term-genre for 655

Description Craig 2020-10-14 18:54:16 UTC
Koha 20.05.04.000 w/ ES 5.x.x.
Ubuntu 18.04
MariaDB

Problem:

After running a keyword search, clicking on a genre/form term URL from within opac-detail returns no results on that term, despite having records with the same gf term in the repository.

Example:

I have 4 bib records in my repository with a genre/form term "Star wars fiction":

1. Keyword search using "index-term-genre:Star wars fiction" returns 4 records.
2. keyword search using phrase "Star wars fiction" with quotes returns 4 records.
3. Subject search using "Star wars fiction" without quotes returns *no results*.
4. Clicking on genre term URL "Star wars fiction" within one of the 4 bib records on opac-detail screen returns *no results*.

I was expecting that nos. 3 and 4 above would return 4 records, but doesn't.

Is this an Elasticsearch problem, an ES configuration problem, an ES mapping problem, or XSLT problem?
Comment 1 Ron Houk 2020-11-22 16:20:00 UTC
I'm seeing this bug as well in Koha 19.11.08.000.  

It looks like the search url that is constructed searches the "su" index instead of the "index-term-genre" index.  This happens on both the staff-side and the OPAC.
Comment 2 Andrew Fuerste-Henry 2020-11-22 20:17:51 UTC
Looks like an XSLT issue:

  <xsl:when test="$TraceSubjectSubdivisions='1'">
    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
        <xsl:with-param name="codes">avxyz</xsl:with-param>
        <xsl:with-param name="delimeter"> AND </xsl:with-param>
        <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
        <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
        <xsl:with-param name="urlencode">1</xsl:with-param>
    </xsl:call-template>
    </xsl:attribute>
</xsl:when>
<xsl:otherwise>
    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
</xsl:otherwise>
Comment 3 Andrew Fuerste-Henry 2020-11-23 15:25:30 UTC
I should clarify, that bit is from MARC21slimOPACdetails for the 655.
Comment 4 Andrew Fuerste-Henry 2020-11-23 16:00:04 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2021-04-14 18:39:12 UTC
Created attachment 119599 [details] [review]
Bug 26679: Use index-term-genre for 655

To test:
1 - have a bib with a 655 that is not linked to an authority
2 - confirm link on OPAC and intranet details uses subject index
3 - apply patch, restart, reload pages
4 - confirm links now use index-term-genre and give correct results

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 6 Martin Renvoize 2021-04-16 14:10:12 UTC
Created attachment 119749 [details] [review]
Bug 26679: Use index-term-genre for 655

To test:
1 - have a bib with a 655 that is not linked to an authority
2 - confirm link on OPAC and intranet details uses subject index
3 - apply patch, restart, reload pages
4 - confirm links now use index-term-genre and give correct results

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2021-04-16 14:10:44 UTC
Looking good, Passing QA
Comment 8 Jonathan Druart 2021-04-16 14:31:00 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 9 Fridolin Somers 2021-04-22 14:44:38 UTC
Pushed to 20.11.x for 20.11.05
Comment 10 Andrew Fuerste-Henry 2021-04-25 17:12:40 UTC
Pushed to 20.05.x for 20.05.11
Comment 11 Victor Grousset/tuxayo 2021-04-25 20:53:33 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.