Bug 28513: Fix analytics search links so they don't match unrelated biblios
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 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
a2f8ba3112
commit
cfe7123679
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue