10 |
=cut |
=cut |
11 |
|
|
12 |
# create and configure node |
# create and configure node |
13 |
my $node = new Search::Estraier::Node; |
my $node = new Search::Estraier::Node( |
14 |
$node->set_url("http://localhost:1978/node/test"); |
url => 'http://localhost:1978/node/test', |
15 |
$node->set_auth("admin","admin"); |
user => 'admin', |
16 |
|
passwd => 'admin', |
17 |
|
croak_on_error => 1, |
18 |
|
); |
19 |
|
|
20 |
# create condition |
# create condition |
21 |
my $cond = new Search::Estraier::Condition; |
my $cond = new Search::Estraier::Condition; |
24 |
$cond->set_phrase("rainbow AND lullaby"); |
$cond->set_phrase("rainbow AND lullaby"); |
25 |
|
|
26 |
my $nres = $node->search($cond, 0); |
my $nres = $node->search($cond, 0); |
27 |
|
|
28 |
if (defined($nres)) { |
if (defined($nres)) { |
29 |
|
print "Got ", $nres->hits, " results\n"; |
30 |
|
|
31 |
# for each document in results |
# for each document in results |
32 |
for my $i ( 0 ... $nres->doc_num - 1 ) { |
for my $i ( 0 ... $nres->doc_num - 1 ) { |
33 |
# get result document |
# get result document |