search ffzg repository
[koha-eprints] / ffzg-search.pl
diff --git a/ffzg-search.pl b/ffzg-search.pl
new file mode 100755 (executable)
index 0000000..b483231
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -I /usr/share/eprints3/perl_lib
+use warnings;
+use strict;
+use autodie;
+use utf8;
+
+# export single record to get structure:
+use Encode;
+use Data::Dump qw(dump);
+use Storable;
+
+use EPrints;
+
+my $stat;
+
+my $ep = EPrints->new();
+my $repo = $ep->repository( 'ffzg' );
+#$repo->{config}->{enable_file_imports} = 1;
+#$repo->{config}->{enable_web_imports} = 1;
+my $dataset = $repo->dataset( 'eprint' );
+my $list = $dataset->search;
+my $count = $list->count;
+warn "# found [$count] eprints\n";
+
+warn ref( $list );
+
+warn "# ids = ",dump( $list->ids );
+
+my $info = { count => 0 };
+$list->map( sub {
+       my( $session, $dataset, $eprint, $info ) = @_;
+
+       if ( my $biblionumber = $eprint->get_value('biblionumber') ) {
+               push @{ $info->{biblionumber}->{$biblionumber} }, $eprint->id;
+       } else {
+               $info->{no_biblionumber}++;
+       }
+       $info->{count}++;
+
+}, $info );
+warn "# map info ",dump( $info );
+
+warn "# stat ", dump($stat);