From: pop Date: Thu, 6 Mar 2003 23:32:10 +0000 (+0000) Subject: Cannot fetch more than 1000 records at a time X-Git-Tag: ZEBRA.1.3.8~22 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=7fc45ea31ae45c60e81074183b096ea0dcc0e60c;p=idzebra-moved-to-github.git Cannot fetch more than 1000 records at a time --- diff --git a/perl/lib/IDZebra/Resultset.pm b/perl/lib/IDZebra/Resultset.pm index 80fabdb..7408d35 100644 --- a/perl/lib/IDZebra/Resultset.pm +++ b/perl/lib/IDZebra/Resultset.pm @@ -1,4 +1,4 @@ -# $Id: Resultset.pm,v 1.8 2003-03-05 13:55:22 pop Exp $ +# $Id: Resultset.pm,v 1.9 2003-03-06 23:32:10 pop Exp $ # # Zebra perl API header # ============================================================================= @@ -12,7 +12,7 @@ BEGIN { use IDZebra::Logger qw(:flags :calls); use Scalar::Util qw(weaken); use Carp; - our $VERSION = do { my @r = (q$Revision: 1.8 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + our $VERSION = do { my @r = (q$Revision: 1.9 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our @ISA = qw(IDZebra::Logger); } @@ -91,6 +91,14 @@ sub records { my $from = $args{from} ? $args{from} : 1; my $to = $args{to} ? $args{to} : $self->{recordCount}; + if (($to-$from) >= 1000) { + if ($args{to}) { + croak ("Cannot fetch more than 1000 records at a time"); + } else { + $to = $from + 999; + } + } + my $elementSet = $args{elementSet} ? $args{elementSet} : 'R'; my $schema = $args{schema} ? $args{schema} : ''; my $recordSyntax = $args{recordSyntax} ? $args{recordSyntax} : ''; @@ -109,7 +117,6 @@ sub records { $to, $ro); - my @res = (); for (my $i=$from; $i<=$to; $i++) { @@ -118,7 +125,7 @@ sub records { if ($class) { } else { - push (@res, $rec); + push (@res, $rec); } }