use IDZebra;
use IDZebra::Logger qw(:flags :calls);
use IDZebra::Repository;
+use IDZebra::Resultset;
use Scalar::Util;
our @ISA = qw(IDZebra::Logger);
IDZebra::close($self->{zh});
$self->{zh} = undef;
}
-
+
if ($self->{odr_input}) {
+ IDZebra::odr_reset($self->{odr_input});
IDZebra::odr_destroy($self->{odr_input});
$self->{odr_input} = undef;
}
if ($self->{odr_output}) {
+ IDZebra::odr_reset($self->{odr_output});
IDZebra::odr_destroy($self->{odr_output});
$self->{odr_output} = undef;
}
}
}
+sub begin_read {
+ my ($self) =@_;
+ return(IDZebra::begin_read($self->{zh}));
+}
+
+sub end_read {
+ my ($self) =@_;
+ IDZebra::end_read($self->{zh});
+}
+
sub shadow_enable {
my ($self, $value) = @_;
if ($#_ > 0) { IDZebra::set_shadow_enable($self->{zh},$value); }
}
# -----------------------------------------------------------------------------
-# Search and retrieval
+# Search
# -----------------------------------------------------------------------------
sub select_databases {
my ($self, @databases) = @_;
\@databases));
}
-sub begin_read {
- my ($self) =@_;
- return(IDZebra::begin_read($self->{zh}));
+sub search_pqf {
+ my ($self, $query, $setname) = @_;
+ my $hits = IDZebra::search_PQF($self->{zh},
+ $self->{odr_input},
+ $self->{odr_output},
+ $query,
+ $setname);
+
+ my $rs = IDZebra::Resultset->new($self,
+ name => $setname,
+ recordCount => $hits,
+ errCode => $self->errCode,
+ errString => $self->errString);
+ return($rs);
}
-sub end_read {
- my ($self) =@_;
- IDZebra::end_read($self->{zh});
-}
+# -----------------------------------------------------------------------------
+# Sort
+#
+# Sorting of multiple result sets is not supported by zebra...
+# -----------------------------------------------------------------------------
-sub search_pqf {
- my ($self, $query, $setname) = @_;
- return (IDZebra::search_PQF($self->{zh},
- $self->{odr_input},
- $self->{odr_output},
- $query,
- $setname));
+sub sortResultsets {
+ my ($self, $sortspec, $setname, @sets) = @_;
+
+ my @setnames;
+ my $count = 0;
+ foreach my $rs (@sets) {
+ push (@setnames, $rs->{name});
+ $count += $rs->{recordCount}; # is this really sure ??? It doesn't
+ # matter now...
+ }
+
+ my $status = IDZebra::sort($self->{zh},
+ $self->{odr_output},
+ $sortspec,
+ $setname,
+ \@setnames);
+
+ my $errCode = $self->errCode;
+ my $errString = $self->errString;
+
+ if ($status || $errCode) {$count = 0;}
+
+ my $rs = IDZebra::Resultset->new($self,
+ name => $setname,
+ recordCount => $count,
+ errCode => $errCode,
+ errString => $errString);
+
+ return ($rs);
}
+
__END__
=head1 NAME