/[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 80 by dpavlin, Mon Jan 16 23:08:07 2006 UTC revision 82 by dpavlin, Tue Jan 17 00:17:50 2006 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use Search::Estraier;  use Search::Estraier;
5  use URI::Escape qw/uri_escape/;  use URI::Escape qw/uri_escape/;
6    use Time::HiRes;
7    use POSIX qw/strftime/;
8    
9  =head1 NAME  =head1 NAME
10    
# Line 30  my $to_n = new Search::Estraier::Node( Line 32  my $to_n = new Search::Estraier::Node(
32    
33  print "Copy from ",$from_n->name," (",$from_n->label,") to ",$to_n->name," (",$to_n->label,") - ",$from_n->doc_num," documents (",$from_n->word_num," words, ",$from_n->size," bytes)\n";  print "Copy from ",$from_n->name," (",$from_n->label,") to ",$to_n->name," (",$to_n->label,") - ",$from_n->doc_num," documents (",$from_n->word_num," words, ",$from_n->size," bytes)\n";
34    
35  my $tick = int($from_n->doc_num / 78);  my $doc_num = $from_n->doc_num || 1;
36    
 print "[";  
37  my $res;  my $res;
38  my $prev;  my $prev;
39  my $i = 0;  my $i = 1;
40    
41    my $t = time();
42    
43  do {  do {
44          $from_n->shuttle_url( $from_n->{url} . '/list',          $from_n->shuttle_url( $from_n->{url} . '/list',
# Line 47  do { Line 50  do {
50          foreach my $l (split(/\n/,$res)) {          foreach my $l (split(/\n/,$res)) {
51                  (my $id, $prev) = split(/\t/,$l, 2);                  (my $id, $prev) = split(/\t/,$l, 2);
52                  $to_n->put_doc( $from_n->get_doc( $id ));                  $to_n->put_doc( $from_n->get_doc( $id ));
53                    $i++;
54          }          }
55          print "$prev\n";          warn "$prev\n";
56          print "." if ($i++ % $tick == 0);  
57            my $rate = ( $i / (time() - $t) );
58            printf("%d records, %1.2f%% [%1.2f rec/s] estimated finish: %s\n",
59                    $i,
60                    ($i * 100 / $doc_num),
61                    $rate,
62                    strftime("%Y-%m-%d %H:%M:%S", localtime( time() + int(($doc_num-$i) / $rate))),
63            );
64    
65  } while ($res);  } while ($res);
66    
 print "]\n";  

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

  ViewVC Help
Powered by ViewVC 1.1.26