--- trunk/lib/WebPAC/Search/Estraier.pm 2005/11/26 01:38:28 152 +++ trunk/lib/WebPAC/Search/Estraier.pm 2005/11/26 14:37:33 156 @@ -13,11 +13,11 @@ =head1 VERSION -Version 0.02 +Version 0.03 =cut -our $VERSION = '0.02'; +our $VERSION = '0.03'; =head1 SYNOPSIS @@ -109,6 +109,7 @@ order => 'NUMD', max => 100, options => $HyperEstraier::Condition::SURE, + page => 42, ); Options are close match to Hyper Estraier API, except C which defines @@ -116,6 +117,8 @@ Results are returned as hash array with keys named by attributes +Pages are numbered C< 1 ... hits/max >. + =cut sub search { @@ -146,10 +149,14 @@ }; $cond->set_phrase( $self->{iconv}->convert($q) ) if ($q); - $cond->set_max( $args->{max} ) if ($args->{max}); $cond->set_options( $args->{options} ) if ($args->{options}); $cond->set_order( $args->{order} ) if ($args->{order}); + my $max = $args->{max} || 7; + my $page = $args->{page} || 1; + + $cond->set_max( $page * $max ); + my $result = $self->{db}->search($cond, 0) || $log->die("can't search for ", sub { Dumper( $args ) }); @@ -158,7 +165,7 @@ my @results; - for my $i ( 0 .. ( $hits - 1 ) ) { + for my $i ( (($page - 1) * $max) .. ( $hits - 1 ) ) { #$log->debug("get_doc($i)"); my $doc = $result->get_doc( $i );