/[Search-Estraier]/trunk/scripts/estcp.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/scripts/estcp.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 82 by dpavlin, Tue Jan 17 00:17:50 2006 UTC revision 83 by dpavlin, Tue Jan 17 00:41:18 2006 UTC
# Line 17  my ($from,$to) = @ARGV; Line 17  my ($from,$to) = @ARGV;
17  die "usage: $0 http://localhost:1978/node/from http://remote.example.com:1978/node/to\n" unless ($from && $to);  die "usage: $0 http://localhost:1978/node/from http://remote.example.com:1978/node/to\n" unless ($from && $to);
18    
19  my $debug = 0;  my $debug = 0;
20    my $max = 256;
21    
22    $max = 1024;
23    
24  # create and configure node  # create and configure node
25  my $from_n = new Search::Estraier::Node(  my $from_n = new Search::Estraier::Node(
# Line 34  print "Copy from ",$from_n->name," (",$f Line 37  print "Copy from ",$from_n->name," (",$f
37    
38  my $doc_num = $from_n->doc_num || 1;  my $doc_num = $from_n->doc_num || 1;
39    
 my $res;  
40  my $prev;  my $prev;
41  my $i = 1;  my $i = 0;
42    my $more = 1;
43    
44  my $t = time();  my $t = time();
45    
46  do {  while($more) {
47            my $res;
48          $from_n->shuttle_url( $from_n->{url} . '/list',          $from_n->shuttle_url( $from_n->{url} . '/list',
49                  'application/x-www-form-urlencoded',                  'application/x-www-form-urlencoded',
50                  'max=256' . ( $prev ? '&prev=' . uri_escape( $prev ) : '' ),                  'max=' . $max . ( $prev ? '&prev=' . uri_escape( $prev ) : '' ),
51                  \$res,                  \$res,
52          );          );
53          last unless ($res);          if (! $res || $res eq '') {
54                    $more = 0;
55                    last;
56            }
57          foreach my $l (split(/\n/,$res)) {          foreach my $l (split(/\n/,$res)) {
58                  (my $id, $prev) = split(/\t/,$l, 2);                  (my $id, $prev) = split(/\t/,$l, 2);
59                  $to_n->put_doc( $from_n->get_doc( $id ));                  $to_n->put_doc( $from_n->get_doc( $id ));
# Line 62  do { Line 69  do {
69                  strftime("%Y-%m-%d %H:%M:%S", localtime( time() + int(($doc_num-$i) / $rate))),                  strftime("%Y-%m-%d %H:%M:%S", localtime( time() + int(($doc_num-$i) / $rate))),
70          );          );
71    
72  } while ($res);  }
73    
74    print "Copy completed.\n";
75    

Legend:
Removed from v.82  
changed lines
  Added in v.83

  ViewVC Help
Powered by ViewVC 1.1.26