[Koha-patches] [PATCH] Bugfix #2928 - Exact authority search by type

Frederic Demians f.demians at tamil.fr
Tue Jan 27 15:10:21 CET 2009


If I have those two authority types:

  - SUB
  - SUB_REGIONAL

If I do a seach on 'SUB', as a result, I get authorities from
SUB _and_ SUBS_REGIONAL.

This patch modify:

  - MARC21 authtype index
  - Search syntax to search on exact authory type
    code match.

On MARC21 install, authorities re-indexing is required.
---
 C4/AuthoritiesMarc.pm                              |    2 +-
 .../authorities/authority-zebra-indexdefs.xsl      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index a5102a6..58e4d29 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -207,7 +207,7 @@ sub SearchAuthorities {
         my @authtypecode;
         my @auths=split / /,$authtypecode ;
         foreach my  $auth (@auths){
-            $query .=" \@attr 1=authtype \@attr 5=100 ".$auth; ##No truncation on authtype
+            $query .=" \@attr 1=authtype \@attr 4=1 \@attr 6=3 ".$auth; # Exact search
             push @authtypecode ,$auth;
             $n++;
         }
diff --git a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
index 4cecf9c..b6b4565 100644
--- a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
+++ b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
@@ -134,7 +134,7 @@
   <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']">
     <xslo:for-each select="marc:subfield">
       <xslo:if test="contains('a', @code)">
-        <z:index name="authtype:w">
+        <z:index name="authtype:w authtype:p">
           <xslo:value-of select="."/>
         </z:index>
       </xslo:if>
-- 
1.5.5.GIT




More information about the Koha-patches mailing list