fixing bugs for :
authortipaul <tipaul>
Tue, 14 Feb 2006 10:54:02 +0000 (10:54 +0000)
committertipaul <tipaul>
Tue, 14 Feb 2006 10:54:02 +0000 (10:54 +0000)
* 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)

C4/SearchMarc.pm

index 095d66f..941aecf 100644 (file)
@@ -223,9 +223,9 @@ sub catalogsearch {
                        $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 @@ sub catalogsearch {
        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)