[Koha-cvs] koha/C4 Search.pm [rel_3_0]

paul poulain paul at koha-fr.org
Thu Nov 16 10:08:39 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	paul poulain <tipaul>	06/11/16 09:08:39

Modified files:
	C4             : Search.pm 

Log message:
	managing UNIMARC marcflavour for scan indexes option

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.120.2.24&r2=1.120.2.25

Patches:
Index: Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.120.2.24
retrieving revision 1.120.2.25
diff -u -b -r1.120.2.24 -r1.120.2.25
--- Search.pm	15 Nov 2006 15:45:25 -0000	1.120.2.24
+++ Search.pm	16 Nov 2006 09:08:38 -0000	1.120.2.25
@@ -39,7 +39,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.120.2.24 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.120.2.25 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -2767,12 +2767,20 @@
                         my ($term,$occ) = $results[$i-1]->term($j);
                         # here we create a minimal MARC record and hand it off to the
                         # template just like a normal result ... perhaps not ideal, but
-                        # it works for now FIXME: distinguish between MARC21 and UNIMARC
+                        # it works for now
                         my $tmprecord = MARC::Record->new();
                         $tmprecord->encoding('UTF-8');
-                        my $tmptitle = MARC::Field->new( '245',' ',' ',
+                        my $tmptitle;
+                        if (C4::Context->preference("marcflavour") eq "UNIMARC") {
+                            $tmptitle = MARC::Field->new( '200',' ',' ',
+                                a => $term,
+                                f => $occ);
+                        } else {
+                            $tmptitle = MARC::Field->new( '245',' ',' ',
                             a => $term,
                             b => $occ);
+                        }
+                        warn $tmptitle->as_formatted;
                         $tmprecord->append_fields($tmptitle);
                         $results_hash->{'RECORDS'}[$j] = $tmprecord->as_usmarc();
                 }
@@ -2862,6 +2870,11 @@
 # build the query itself
 sub buildQuery {
     my ($query,$operators,$operands,$indexes,$limits,$sort_by) = @_;
+    warn "OPERATORS : ".Data::Dumper::Dumper($operators);
+    warn "OPERANDS : ".Data::Dumper::Dumper($operands);
+    warn "INDEXES : ".Data::Dumper::Dumper($indexes);
+    warn "LIMITS : ".Data::Dumper::Dumper($limits);
+    warn "SORT BY : ".Data::Dumper::Dumper($sort_by);
     my @operators = @$operators if $operators;
     my @indexes = @$indexes if $indexes;
     my @operands = @$operands if $operands;
@@ -2936,7 +2949,7 @@
                             $weighted_query .= " $operand";
                         }
                         else {
-                            $weighted_query .= " Title-cover,ext,r1=$operand";        # index label as exact 
+                            $weighted_query .= " Title-cover,ext,r1=\"$operand\"";        # index label as exact 
                             $weighted_query .= " or ti,ext,r2=$operand";         # index as exact 
                             #$weighted_query .= " or ti,phr,r3=$operand";              # index as  phrase
                             #$weighted_query .= " or any,ext,r4=$operand";         # index as exact 





More information about the Koha-cvs mailing list