1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
use Search::Estraier; |
5 |
|
6 |
=head1 NAME |
7 |
|
8 |
example_indexer.pl - example indexer for Search::Estraier |
9 |
|
10 |
=cut |
11 |
|
12 |
# create and configure node |
13 |
my $node = new Search::Estraier::Node( |
14 |
url => 'http://localhost:1978/node/test', |
15 |
user => 'admin', |
16 |
passwd => 'admin' |
17 |
); |
18 |
|
19 |
# create document |
20 |
my $doc = new Search::Estraier::Document; |
21 |
|
22 |
# add attributes |
23 |
$doc->add_attr('@uri', "http://estraier.gov/example.txt"); |
24 |
$doc->add_attr('@title', "Over the Rainbow"); |
25 |
|
26 |
# add body text to document |
27 |
$doc->add_text("Somewhere over the rainbow. Way up high."); |
28 |
$doc->add_text("There's a land that I heard of once in a lullaby."); |
29 |
|
30 |
die "error: ", $node->status,"\n" unless ($node->put_doc($doc)); |
31 |
|