/[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

Annotation of /trunk/scripts/estcp.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 80 - (hide annotations)
Mon Jan 16 23:08:07 2006 UTC (18 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 1210 byte(s)
copy Hyper Estraier index from one node to another
1 dpavlin 80 #!/usr/bin/perl -w
2    
3     use strict;
4     use Search::Estraier;
5     use URI::Escape qw/uri_escape/;
6    
7     =head1 NAME
8    
9     estcp.pl - copy Hyper Estraier index from one node to another
10    
11     =cut
12    
13     my ($from,$to) = @ARGV;
14    
15     die "usage: $0 http://localhost:1978/node/from http://remote.example.com:1978/node/to\n" unless ($from && $to);
16    
17     my $debug = 0;
18    
19     # create and configure node
20     my $from_n = new Search::Estraier::Node(
21     url => $from,
22     croak_on_error => 1,
23     debug => $debug,
24     );
25     my $to_n = new Search::Estraier::Node(
26     url => $to,
27     croak_on_error => 1,
28     debug => $debug,
29     );
30    
31     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";
32    
33     my $tick = int($from_n->doc_num / 78);
34    
35     print "[";
36     my $res;
37     my $prev;
38     my $i = 0;
39    
40     do {
41     $from_n->shuttle_url( $from_n->{url} . '/list',
42     'application/x-www-form-urlencoded',
43     'max=256' . ( $prev ? '&prev=' . uri_escape( $prev ) : '' ),
44     \$res,
45     );
46     last unless ($res);
47     foreach my $l (split(/\n/,$res)) {
48     (my $id, $prev) = split(/\t/,$l, 2);
49     $to_n->put_doc( $from_n->get_doc( $id ));
50     }
51     print "$prev\n";
52     print "." if ($i++ % $tick == 0);
53     } while ($res);
54    
55     print "]\n";

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26