1 package BackupPC::Search::Estraier;
7 my $debug = $ENV{DEBUG} || 0;
10 my ( $class, $index_node_url ) = @_;
12 warn "# using $index_node_url";
15 node => Search::Estraier::Node->new(
16 url => $index_node_url,
25 sub node { $_[0]->{node} };
28 my ( $self, $row ) = @_;
30 my $uri = $row->{hname} . ':' . $row->{sname} . '#' . $row->{backupnum} . ' ' . $row->{filepath};
31 my $id = $self->node->uri_to_id($uri);
32 return $id && $id != -1;
36 my ( $self, $row ) = @_;
38 # create a document object
39 my $doc = Search::Estraier::Document->new;
41 my $uri = $row->{hname} . ':' . $row->{sname} . '#' . $row->{backupnum} . ' ' . $row->{filepath};
42 # add attributes to the document object
43 $doc->add_attr('@uri', $uri);
45 foreach my $c (keys %$row) {
46 print STDERR "attr $c = $row->{$c}\n" if ($debug > 2);
47 $doc->add_attr($c, $row->{$c}) if defined($row->{$c});
50 #$doc->add_attr('@cdate', fmt_date($row->{'date'}));
52 # add the body text to the document object
53 my $path = $row->{'filepath'};
54 $doc->add_text($path);
56 $doc->add_hidden_text($path);
58 print STDERR $doc->dump_draft,"\n" if ($debug > 1);
60 # register the document object to the database
61 $self->node->put_doc($doc);
67 warn "# commit not needed";