[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Search.pm
From: |
paul poulain |
Subject: |
[Koha-cvs] koha/C4 Search.pm |
Date: |
Fri, 04 May 2007 13:59:16 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: paul poulain <tipaul> 07/05/04 13:59:16
Modified files:
C4 : Search.pm
Log message:
bugfixes for NoZebra : handling results_per_page and adding NoZebra
support to SimpleSearch
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&r1=1.135&r2=1.136
Patches:
Index: Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- Search.pm 2 May 2007 16:44:31 -0000 1.135
+++ Search.pm 4 May 2007 13:59:16 -0000 1.136
@@ -25,7 +25,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.135 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.136 $' =~ /\d+/g;
shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
};
@@ -181,6 +181,14 @@
sub SimpleSearch {
my $query = shift;
+ if (C4::Context->preference('NoZebra')) {
+ my $result = NZorder(NZanalyse($query))->{'biblioserver'}->{'RECORDS'};
+ use Data::Dumper;
+ foreach (@$result) {
+ warn "$query :"address@hidden;
+ }
+ return (undef,$result);
+ } else {
my @servers = @_;
my @results;
my @tmpresults;
@@ -223,6 +231,7 @@
}
}
return ( undef, address@hidden );
+ }
}
# performs the search
@@ -1433,6 +1442,8 @@
$result_hash->{'RECORDS'}[$numbers++] = $result{$key};
}
}
+ # limit the $results_per_page to result size if it's more
+ $results_per_page = $numbers-1 if $numbers < $results_per_page;
# for the requested page, replace biblionumber by the complete record
# speed improvement : avoid reading too much things
for (my
$counter=$offset;$counter<=$offset+$results_per_page;$counter++) {
@@ -1471,6 +1482,8 @@
foreach my $key (sort {$b <=> $a} (keys %result)) {
$result_hash->{'RECORDS'}[$numbers++] = $result{$key};
}
+ # limit the $results_per_page to result size if it's more
+ $results_per_page = $numbers-1 if $numbers < $results_per_page;
# for the requested page, replace biblionumber by the complete record
# speed improvement : avoid reading too much things
for (my
$counter=$offset;$counter<=$offset+$results_per_page;$counter++) {
- [Koha-cvs] koha/C4 Search.pm,
paul poulain <=