3 # This is the scanning counterpart to zoomscan.pl's searching
4 # perl -I../../blib/lib -I../../blib/arch zoomscan.pl <target> <scanQuery>
6 # For example (using Z39.50 and SRW, Type-1 and CQL):
7 # perl zoomscan.pl tcp:localhost:8018/IR-Explain---1 '@attr 1=dc.title the'
8 # perl zoomscan.pl http://localhost:8018/IR-Explain---1 '@attr 1=dc.title the'
9 # perl zoomscan.pl -q http://localhost:8018/IR-Explain---1 'dc.title=the'
17 if (!getopts('q', \%opts) || @ARGV != 2) {
18 print STDERR "Usage: $0 [options] target scanQuery
19 -q Query is CQL [default: PQF]
20 eg. $0 z3950.indexdata.dk/gils computer\n";
24 my($host, $scanQuery) = @ARGV;
27 my $conn = new ZOOM::Connection($host, 0);
28 $conn->option(preferredRecordSyntax => "usmarc");
29 ### Could use ZOOM::Query::CQL below, but that only works in SRU/W.
30 my $q = $opts{q} ? new ZOOM::Query::CQL($scanQuery) :
31 new ZOOM::Query::PQF($scanQuery);
32 my $ss = $conn->scan($q);
35 my($term, $occ) = $ss->term($i);
36 print $i+1, ": $term";
37 print " ($occ)" if defined $occ;
44 die "Non-ZOOM error: $@" if !$@->isa("ZOOM::Exception");
45 print STDERR "ZOOM error $@\n";