[Patches] [PATCH] Bug 5369: se queries with paranthesis fail

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Tue Nov 29 09:05:02 NZDT 2011


From: Katrin Fischer <Katrin.Fischer.83 at web.de>
Date: Mon, 28 Nov 2011 07:25:37 +0100
Subject: [PATCH] Bug 5369: se queries with paranthesis fail

This patch does several things to make the search work better:

1) Adding "" around search terms for queries on index se.
2) Make links for 8xx obey the UseControlNumber system preference
3) Fix the indexing for 8xx fields, as they were not included in the se index before

Note: Make sure you copy the new record.abs into your koha-dev directory and reindex
before testing.

To test:
1) Add records using the following fields:
440$a
490$a ind. 1 = empty or 0
490$a ind. 1 = 1
800$a, 810$a, 811$a or 830$a

Example value taken form bug description, should only work after applying the patch:
DHEW publication no. (HSM) 73-1804

Please also test with other examples.
---
 etc/zebradb/marc_defs/marc21/biblios/record.abs    |   16 ++++++++--------
 .../prog/en/xslt/MARC21slim2intranetDetail.xsl     |   12 ++++++------
 .../prog/en/xslt/MARC21slim2OPACDetail.xsl         |    8 ++++----
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/etc/zebradb/marc_defs/marc21/biblios/record.abs b/etc/zebradb/marc_defs/marc21/biblios/record.abs
index 92467ab..6983230 100755
--- a/etc/zebradb/marc_defs/marc21/biblios/record.abs
+++ b/etc/zebradb/marc_defs/marc21/biblios/record.abs
@@ -241,27 +241,27 @@ melm 785$w      Record-control-number
 melm 785        Title,Title:p,Title-later,Related-periodical
 melm 787$w      Record-control-number
 
-melm 800$a      Name-and-title
+melm 800$a      Name-and-title,Title-series:w,Title-series:p
 #melm 800$t     author,Author-title,Name-and-title,Title,Title-series
-melm 800$t      Author-title,Name-and-title,Title,Title-series
+melm 800$t      Author-title,Name-and-title,Title,Title-series:w,Title-series:p
 melm 800$9      Koha-Auth-Number
 melm 800$w      Record-control-number
 melm 800        Author,Author-name-personal,Name,Personal-name
-melm 810$a      Name-and-title
-melm 810$t      Author-title,Name-and-title,Title,Title-series
+melm 810$a      Name-and-title,Title-series:w,Title-series:p
+melm 810$t      Author-title,Name-and-title,Title,Title-series:w,Title-series:p
 melm 810$w      Record-control-number
 melm 810$9      Koha-Auth-Number
 melm 810        Author,Corporate-name,Author-name-corporate,Name
-melm 811$a      Name-and-title
+melm 811$a      Name-and-title,Title-series:w,Title-series:p
 melm 811$9      Koha-Auth-Number
 #melm 811$t     author,Author-title,Name-and-title,Title,Title-series
-melm 811$t      Author-title,Name-and-title,Title,Title-series
+melm 811$t      Author-title,Name-and-title,Title,Title-series:w,Title-series:p
 melm 811$w      Record-control-number
 melm 811        Author,Author-name-corporate,Name,Conference-name
 melm 830$w      Record-control-number
 melm 830$9      Koha-Auth-Number
-melm 830        Title,Title-series
-melm 840        Title,Title-series
+melm 830        Title,Title-series:w,Title-series:p
+melm 840        Title,Title-series:w,Title-series:p
 
 ###############################
 # Koha Local-Use Biblio Indexes
diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
index b0de609..b84db99 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
@@ -152,7 +152,7 @@
         <span class="results_summary series"><span class="label">Series: </span>
         <!-- 440 -->
         <xsl:for-each select="marc:datafield[@tag=440]">
-             <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
+            <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se:"<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
             <xsl:call-template name="chopPunctuation">
                             <xsl:with-param name="chopString">
                                 <xsl:call-template name="subfieldSelect">
@@ -167,7 +167,7 @@
 
         <!-- 490 Series not traced, Ind1 = 0 -->
         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
-             <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
+            <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se:"<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
                         <xsl:call-template name="chopPunctuation">
                             <xsl:with-param name="chopString">
                                 <xsl:call-template name="subfieldSelect">
@@ -183,23 +183,23 @@
         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
                 <xsl:choose>
-                    <xsl:when test="marc:subfield[@code='w']">
+                    <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
                             <xsl:call-template name="chopPunctuation">
                                 <xsl:with-param name="chopString">
                                     <xsl:call-template name="subfieldSelect">
-                                        <xsl:with-param name="codes">at</xsl:with-param>
+                                        <xsl:with-param name="codes">a_t</xsl:with-param>
                                     </xsl:call-template>
                                 </xsl:with-param>
                             </xsl:call-template>
                         </a>
                     </xsl:when>
                     <xsl:otherwise>
-                        <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
+                        <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
                             <xsl:call-template name="chopPunctuation">
                                 <xsl:with-param name="chopString">
                                     <xsl:call-template name="subfieldSelect">
-                                        <xsl:with-param name="codes">at</xsl:with-param>
+                                        <xsl:with-param name="codes">a_t</xsl:with-param>
                                     </xsl:call-template>
                                 </xsl:with-param>
                             </xsl:call-template>
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
index e16db73..3fdcb19 100755
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
@@ -210,7 +210,7 @@
         <span class="results_summary series"><span class="label">Series: </span>
         <!-- 440 -->
         <xsl:for-each select="marc:datafield[@tag=440]">
-             <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
+            <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se:"<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
             <xsl:call-template name="chopPunctuation">
                             <xsl:with-param name="chopString">
                                 <xsl:call-template name="subfieldSelect">
@@ -225,7 +225,7 @@
 
         <!-- 490 Series not traced, Ind1 = 0 -->
         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
-             <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
+            <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se:"<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
                         <xsl:call-template name="chopPunctuation">
                             <xsl:with-param name="chopString">
                                 <xsl:call-template name="subfieldSelect">
@@ -241,7 +241,7 @@
         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
                 <xsl:choose>
-                    <xsl:when test="marc:subfield[@code='w']">
+                    <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
                         <a href="/cgi-bin/koha/opac-search.pl?q=rcn:{marc:subfield[@code='w']}">
                             <xsl:call-template name="chopPunctuation">
                                 <xsl:with-param name="chopString">
@@ -253,7 +253,7 @@
                         </a>
                     </xsl:when>
                     <xsl:otherwise>
-                        <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
+                        <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
                             <xsl:call-template name="chopPunctuation">
                                 <xsl:with-param name="chopString">
                                     <xsl:call-template name="subfieldSelect">
-- 
1.7.5.4


More information about the Patches mailing list