4 # ./reindex.pl user=admin,password=SWORDFISH,localhost:8018/IR-Explain---1
5 # ./reindex.pl -d -q zeerex.reliability=0 localhost:8018/IR-Explain---1
15 my $query = 'cql.allRecords=1';
19 'noAction' => \$noAction,
22 print STDERR "Usage: $0 [-s|--setUdb] [-d|--delete] [-n|--noaction] [-q <query>] <target>\n";
26 my $conn = new ZOOM::Connection($ARGV[0]);
27 $conn->option(preferredRecordSyntax => "xml");
28 $conn->option(elementSetName => "zebra::data");
29 my $rs = $conn->search(new ZOOM::Query::CQL($query));
33 print "$0: reindexing $n records\n";
34 foreach my $i (1..$n) {
36 print " $i/$n (", int($i*100/$n), "%)\n" if $i % 50 == 0;
37 my $rec = $rs->record($i-1);
38 my $xml = $rec->render();
42 if ($xml !~ /<(e:)?databaseInfo.*?>/) {
43 $udb = qq[<i:udb xmlns:i="http://indexdata.com/irspy/1.0">irspy-a$i</i:udb>];
44 $xml =~ s/\/serverInfo>/$&<databaseInfo>$udb<\/databaseInfo>/;
47 $udb = qq[<i:udb xmlns:i="http://indexdata.com/irspy/1.0">irspy-$i</i:udb>];
48 $xml =~ s/<(e:)?databaseInfo.*?>/$&$udb/;
54 print " $n/$n (100%)\n" if $n % 50 != 0;
59 # These might be better as ZOOM::Connection methods
64 my $p = $conn->package();
65 $p->option(action => $delete ? "recordDelete" : "specialUpdate");
66 $p->option(record => $xml);
74 my $p = $conn->package();