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

Henri-Damien LAURENT laurenthdl at alinto.com
Tue Sep 26 18:16:08 CEST 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Henri-Damien LAURENT <hdl>	06/09/26 16:16:08

Modified files:
	C4             : Search.pm 
	koha-tmpl/intranet-tmpl/prog/en/search.marc: search.tmpl 

Log message:
	Modifying Search.pm and search.tmpl in order to build a good rpn search and re-establish some filtered search for zebra.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.120.2.4&r2=1.120.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/search.marc/search.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.1&r2=1.2.2.2

Patches:
Index: C4/Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.120.2.4
retrieving revision 1.120.2.5
diff -u -b -r1.120.2.4 -r1.120.2.5
--- C4/Search.pm	21 Sep 2006 14:00:23 -0000	1.120.2.4
+++ C4/Search.pm	26 Sep 2006 16:16:08 -0000	1.120.2.5
@@ -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.4 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.120.2.5 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -243,9 +243,10 @@
     $startfrom = $offset; # offset
     my $ccl_query;
     for (my $i = 0 ; $i <= $#{$value} ; $i++) {
-        $ccl_query.= @$value[$i];
+        $ccl_query= ($ccl_query?'@'.@$and_or[$i]:"").' @attr 1='.@$tags[$i]." ".@$value[$i].$ccl_query if (@$value[$i]);
     }
-    my ($error,$count,$facets, at results) = searchZOOM('search','ccl',$ccl_query,$number_of_results,$startfrom,$then_sort_by);
+    warn "ccl_query :".$ccl_query;
+    my ($error,$count,$facets, at results) = searchZOOM('search','rpn',$ccl_query,$number_of_results,$startfrom,$then_sort_by);
 
     my @result = ();
     my $subtitle; # Added by JF for Subtitles
@@ -254,6 +255,7 @@
     #put them in @result
     foreach my $rec (@results) {
         my $record = MARC::Record->new_from_usmarc($rec);
+        warn "record :=".$record->as_formatted;
         my $oldbiblio = MARCmarc2koha($dbh,$record,'');
         push @result, $oldbiblio->{'biblionumber'}; #FIXME bibid?
     }
@@ -449,7 +451,7 @@
 	$search->{'ttype1'}="exact";
 	$search->{'atype1'}="start";
 	}
-	my ($total, at result)=CatSearch4($type,$search,1,0);
+	my ($total, at result)=CatSearch($type,$result,1,0);
 		return $result[0]->{'biblionumber'}, $result[0]->{'biblionumber'},$result[0]->{'title'} if ($total);
 
 }
@@ -2646,6 +2648,7 @@
 	# establish database connections
     my $dbh = C4::Context->dbh;
     my $zconn=C4::Context->Zconn("biblioserver");
+    warn "connected";
 	my $branches = GetBranches();
 	# make sure all is well with the connection
     if ($zconn eq "error") {
@@ -2656,6 +2659,7 @@
 
 	# prepare the query depending on the type
     if ($type eq 'ccl') {
+        warn "query : $query";
 		#$query =~ s/(\(|\))//g;
         eval {
         	$koha_query_obj = new ZOOM::Query::CCL2RPN($query,$zconn);
@@ -2709,13 +2713,13 @@
 	my $facets = [ {
 		link_value => 'su',
 		label_value => 'Subject - Topic',
-		tags => ['650', '651',],
+		tags => ['600', '610',],
 		subfield => 'a',
 		},
 		{
         link_value => 'au',
         label_value => 'Authors',
-        tags => ['100','700',],
+        tags => ['701','700',],
         subfield => 'a',
 		},
 		{
@@ -2727,8 +2731,8 @@
 		{
         link_value => 'branch',
         label_value => 'Branches',
-        tags => ['952',],
-        subfield => 'b',
+        tags => ['995',],
+        subfield => 'c',
 		expanded => '1',
         },
 	];
@@ -2756,6 +2760,8 @@
         } else {
             my $rec = $result->record($i);
             push(@results,$rec->raw()) if $rec; #FIXME: sometimes this fails
+            my $tmprecord = MARC::Record->new_from_usmarc($rec->raw());
+            warn "rec$i :".$tmprecord->as_formatted;
 			
             ##### BUILD FACETS AND LIMITS ####
 			my $facet_record = MARC::Record->new_from_usmarc($rec->raw());

Index: koha-tmpl/intranet-tmpl/prog/en/search.marc/search.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/search.marc/Attic/search.tmpl,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -b -r1.2.2.1 -r1.2.2.2
--- koha-tmpl/intranet-tmpl/prog/en/search.marc/search.tmpl	22 Sep 2006 15:56:13 -0000	1.2.2.1
+++ koha-tmpl/intranet-tmpl/prog/en/search.marc/search.tmpl	26 Sep 2006 16:16:08 -0000	1.2.2.2
@@ -20,7 +20,7 @@
 		</tr>
 		<tr>
 			<th><label for="title">Title</label></th>
-			<td><input type="hidden" name="marclist" value="biblio.title" />
+			<td><input type="hidden" name="marclist" value="Title" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="contains" />
@@ -30,7 +30,7 @@
 		</tr>
 		<tr>
 			<th><label for="author"><span class="accesskey" title="Access Key a">Author</label></th>
-			<td><input type="hidden" name="marclist" value="biblio.author" />
+			<td><input type="hidden" name="marclist" value="Author" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="contains" />
@@ -40,7 +40,7 @@
 		</tr>
 		<tr>
 			<th><label for="subject">Subject</label></th>
-			<td><input type="hidden" name="marclist" value="bibliosubject.subject" />
+			<td><input type="hidden" name="marclist" value="Subject-heading" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="contains" />  
@@ -49,14 +49,14 @@
 			</a></td>
 		</tr>
 <tr><th><label for="seriestitle">Series title</label></th><td>			
-			<input type="hidden" name="marclist" value="biblio.seriestitle" />
+			<input type="hidden" name="marclist" value="Title-Series" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="contains" />
 			<input type="text" id="seriestitle" name="value" size="35"/></td></tr>
 		<tr>
 			<th><label for="itemtype">Item Type</label></th>
-			<td><input type="hidden" name="marclist" value="biblioitems.itemtype" />
+			<td><input type="hidden" name="marclist" value="Itemtype" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="=" />
@@ -80,7 +80,7 @@
 		</tr>
 		<tr>
 			<th><label for="callno">Call Number</label></th>
-			<td><input type="hidden" name="marclist" value="items.itemcallnumber" />
+			<td><input type="hidden" name="marclist" value="Call-Number" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="start" />
@@ -88,7 +88,7 @@
 		</tr>
 		<tr>
 			<th><label for="isbn">ISBN</label></th>
-			<td><input type="hidden" name="marclist" value="biblioitems.isbn" />
+			<td><input type="hidden" name="marclist" value="ISBN" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="=" />
@@ -96,7 +96,7 @@
 		</tr>
 		<tr>
 			<th><label for="publisher">Publisher</label></th>
-			<td><input type="hidden" name="marclist" value="biblioitems.publishercode" />
+			<td><input type="hidden" name="marclist" value="Publisher" />
 			<input type="hidden" name="and_or" value="and" />
 			<input type="hidden" name="excluding" value="" />
 			<input type="hidden" name="operator" value="contains" />





More information about the Koha-cvs mailing list