Bug 5369: se queries with paranthesis fail
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Mon, 28 Nov 2011 06:25:37 +0000 (07:25 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 6 Jan 2012 13:11:35 +0000 (14:11 +0100)
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.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
etc/zebradb/marc_defs/marc21/biblios/record.abs
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl

index 92467ab..6983230 100755 (executable)
@@ -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
index 6c640b2..c73990d 100644 (file)
         <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">
 
         <!-- 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">
         <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>
index 2d88880..f0660a7 100755 (executable)
         <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">
 
         <!-- 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">
         <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">
                         </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">