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 |
$node->set_url("http://localhost:1978/node/test"); |
15 |
$node->set_auth("admin","admin"); |
16 |
|
17 |
# create document |
18 |
my $doc = new Search::Estraier::Document; |
19 |
|
20 |
# add attributes |
21 |
$doc->add_attr('@uri', "http://estraier.gov/example.txt"); |
22 |
$doc->add_attr('@title', "Over the Rainbow"); |
23 |
|
24 |
# add body text to document |
25 |
$doc->add_text("Somewhere over the rainbow. Way up high."); |
26 |
$doc->add_text("There's a land that I heard of once in a lullaby."); |
27 |
|
28 |
die "error: ", $node->status,"\n" unless ($node->put_doc($doc)); |
29 |
|