[Koha-cvs] koha/C4 SearchMarc.pm

paul poulain paul at koha-fr.org
Tue Feb 14 11:54:02 CET 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	
Changes by:	paul poulain <tipaul at savannah.gnu.org>	06/02/14 10:54:02

Modified files:
	C4             : SearchMarc.pm 

Log message:
	fixing bugs for :
	* search on 2 words "applied chaos"
	* retrieve results when there's only 1 answer
	(still dirty & to be rewritten by chris, but it's useful for me)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/SearchMarc.pm.diff?tr1=1.53&tr2=1.54&r1=text&r2=text

Patches:
Index: koha/C4/SearchMarc.pm
diff -u koha/C4/SearchMarc.pm:1.53 koha/C4/SearchMarc.pm:1.54
--- koha/C4/SearchMarc.pm:1.53	Mon Feb 13 23:52:04 2006
+++ koha/C4/SearchMarc.pm	Tue Feb 14 10:54:02 2006
@@ -223,9 +223,9 @@
 			$query .= " and " if ($query);
 			my $field = $tagslib->{$tag}->{$subfield}->{kohafield};
 			if ($field eq 'biblio.author') {
-				$query .= "Author= ".@$value[$i];
+				$query .= "Author= \"".@$value[$i]."\"";
 			} elsif ($field eq 'biblio.title') {
-				$query .= "Title= ".@$value[$i];
+				$query .= "Title= \"".@$value[$i]."\"";
 			} elsif ($field eq 'biblioitems.isbn') {
 				$query .= "Isbn= ".@$value[$i];
 			} else {
@@ -260,8 +260,8 @@
 	my $totalitems=0;
 	$offset=0 unless $offset;
 	# calculate max offset
-	my $maxrecordnum = $offset+$length<$numresults?$offset+$length:$numresults;
-	for (my $i=$offset; $i < $maxrecordnum; $i++) {
+	my $maxrecordnum = $offset+$length<$numresults?$offset+$length:($numresults);
+	for (my $i=$offset-1; $i <= $maxrecordnum-1; $i++) {
 		# get the MARC record (in XML)...
 		# warn "REC $i = ".$rs->record($i)->raw();
 # FIXME : it's a silly way to do things : XML => MARC::Record => hash. We had better developping a XML=> hash (in biblio.pm)





More information about the Koha-cvs mailing list