Bugzilla – Attachment 121629 Details for
Bug 28513
Analytic search links formed incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28513: Fix analytics search links so they don't match unrelated biblios
Bug-28513-Fix-analytics-search-links-so-they-dont-.patch (text/plain), 5.00 KB, created by
Joonas Kylmälä
on 2021-06-04 11:25:22 UTC
(
hide
)
Description:
Bug 28513: Fix analytics search links so they don't match unrelated biblios
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-06-04 11:25:22 UTC
Size:
5.00 KB
patch
obsolete
>From 28d08e41217179dd8769c6f1ceac51a72dc7757f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi> >Date: Fri, 4 Jun 2021 14:06:53 +0300 >Subject: [PATCH] Bug 28513: Fix analytics search links so they don't match > unrelated biblios >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >At least when using Searchengine=Elasticsearch what happened was that >without () parenthese included the search for Host-item field was done >only to the first token, the subsequent ones matched any >fields. Adding the parentheses restrict the search to Host-item search >field only. > >To test: > 1) Set Searchengine = elasticsearch > 2) Make a biblio with 245a = "biológica paranaense." and 773a = "Acta" > 3) Go to a biblio with 245a = "Acta biológica paranaense" (in > kohadevbox or create one if you need). > 4) Notice that the "Acta biológica paranaense" biblio's detail page link "Show > analytics" takes to the "biológica paranaense" incorrectly just > because the 773a has "Acta" and the words "biológica" and "paranaense" > appear elsewhere in the biblio. > 5) Apply patch and notice the link is now not created at all >--- > catalogue/detail.pl | 2 +- > .../intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 2 +- > opac/opac-detail.pl | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 8d06f0da51..c0d16f30a4 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -132,7 +132,7 @@ if ( $xslfile ) { > my $query = > ( C4::Context->preference('UseControlNumber') and $record->field('001') ) > ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)' >- : "Host-item:$cleaned_title"; >+ : "Host-item:($cleaned_title)"; > my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 ); > > warn "Warning from simple_search_compat: $err" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index 079f44a14a..196d5857ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -222,7 +222,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:(<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/>)</xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show analytics</xsl:text> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index 4341bf0950..0110d22215 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -257,7 +257,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:(<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/>)</xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show analytics</xsl:text> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 6173b72862..1b7f98f64d 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -188,7 +188,7 @@ if ( $xslfile ) { > my $query = > ( C4::Context->preference('UseControlNumber') and $record->field('001') ) > ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)' >- : "Host-item:$cleaned_title"; >+ : "Host-item:($cleaned_title)"; > my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 ); > > warn "Warning from simple_search_compat: $err" >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28513
:
121629
|
121635
|
121869