20 |
my $node = new Search::Estraier::Node( |
my $node = new Search::Estraier::Node( |
21 |
url => 'http://localhost:1978/node/test', |
url => 'http://localhost:1978/node/test', |
22 |
user => 'admin', |
user => 'admin', |
23 |
passwd => 'admin' |
passwd => 'admin', |
24 |
|
create => 1, |
25 |
|
label => 'Label for node', |
26 |
|
croak_on_error => 1, |
27 |
); |
); |
28 |
|
|
29 |
# create document |
# create document |
877 |
url => 'http://localhost:1978/node/test', |
url => 'http://localhost:1978/node/test', |
878 |
user => 'admin', |
user => 'admin', |
879 |
passwd => 'admin' |
passwd => 'admin' |
880 |
|
create => 1, |
881 |
|
label => 'optional node label', |
882 |
debug => 1, |
debug => 1, |
883 |
croak_on_error => 1 |
croak_on_error => 1 |
884 |
); |
); |
899 |
|
|
900 |
password for authentication |
password for authentication |
901 |
|
|
902 |
|
=item create |
903 |
|
|
904 |
|
create node if it doesn't exists |
905 |
|
|
906 |
|
=item label |
907 |
|
|
908 |
|
optional label for new node if C<create> is used |
909 |
|
|
910 |
=item debug |
=item debug |
911 |
|
|
912 |
dumps a B<lot> of debugging output |
dumps a B<lot> of debugging output |
950 |
size => -1.0, |
size => -1.0, |
951 |
}; |
}; |
952 |
|
|
953 |
|
if ($self->{create}) { |
954 |
|
eval { |
955 |
|
$self->name; |
956 |
|
}; |
957 |
|
if ($@) { |
958 |
|
my $name = $1 if ($self->{url} =~ m#/node/([^/]+)/*#); |
959 |
|
croak "can't find node name in '$self->{url}'" unless ($name); |
960 |
|
my $label = $self->{label} || $name; |
961 |
|
$self->master( |
962 |
|
action => 'nodeadd', |
963 |
|
name => $name, |
964 |
|
label => $label, |
965 |
|
) || croak "can't create node $name ($label)"; |
966 |
|
} |
967 |
|
} |
968 |
|
|
969 |
$self ? return $self : return undef; |
$self ? return $self : return undef; |
970 |
} |
} |
971 |
|
|