154 |
|
|
155 |
my $tb = new HyperEstraier::WAIT::Table( |
my $tb = new HyperEstraier::WAIT::Table( |
156 |
uri => $OPT{node}, |
uri => $OPT{node}, |
157 |
attr => ['docid', 'headline', 'source', 'size', 'parent'], |
attr => ['docid', 'headline', 'source', 'size', 'parent', 'version'], |
158 |
key => 'docid', |
key => 'docid', |
159 |
invindex => [ qw/name synopsis bugs description text environment example author/ ], |
invindex => [ qw/name synopsis bugs description text environment example author/ ], |
160 |
debug => $OPT{debug}, |
debug => $OPT{debug}, |
422 |
next if $OPT{match} and $ARCHIVE{$tar} !~ /$OPT{match}/o; |
next if $OPT{match} and $ARCHIVE{$tar} !~ /$OPT{match}/o; |
423 |
my $base = (split /\//, $ARCHIVE{$tar})[-1]; |
my $base = (split /\//, $ARCHIVE{$tar})[-1]; |
424 |
my $parent; |
my $parent; |
|
my $parent_mdate; |
|
425 |
|
|
426 |
my %attr; |
my %attr; |
427 |
|
|
428 |
# logging |
# logging |
429 |
if ($OPT{trust_mtime}) { |
if ($OPT{trust_mtime}) { |
430 |
$attr{'@mdate'} = strftime('%Y-%m-%dT%H:%M:%S+00:00', gmtime($VERSION{$tar})); |
$attr{'@mdate'} = strftime('%Y-%m-%dT%H:%M:%S+00:00', gmtime($VERSION{$tar})); |
431 |
$parent_mdate = $attr{'@mdate'}; |
$parent->{'@mdate'} = $attr{'@mdate'}; |
432 |
printf "%-20s %10s %s\t", $tar, $attr{'@mdate'}, $base; |
printf "%-20s %10s %s\t", $tar, $attr{'@mdate'}, $base; |
433 |
} else { |
} else { |
434 |
$attr{'version'} = $VERSION{$tar}; |
$attr{'version'} = $VERSION{$tar}; |
441 |
print "skipping\n"; |
print "skipping\n"; |
442 |
next ARCHIVE; |
next ARCHIVE; |
443 |
} else { |
} else { |
444 |
$parent = $tb->insert(docid => $base, |
$parent->{_id} = $tb->insert(docid => $base, |
445 |
headline => $ARCHIVE{$tar}, |
headline => $ARCHIVE{$tar}, |
446 |
%attr |
%attr |
447 |
) unless $OPT{test}; |
) unless $OPT{test}; |
499 |
print "Please alias '$tar' to '$prefix' next time!\n"; |
print "Please alias '$tar' to '$prefix' next time!\n"; |
500 |
print "See alias table later.\n"; |
print "See alias table later.\n"; |
501 |
$NEW_ALIAS{$tar} = $prefix; |
$NEW_ALIAS{$tar} = $prefix; |
502 |
$tb->delete_by_key($parent); |
$tb->delete_by_key($parent->{_id}); |
503 |
next ARCHIVE; |
next ARCHIVE; |
504 |
} else { |
} else { |
505 |
print "Assuming that tar file name $tar is a valid prefix\n"; |
print "Assuming that tar file name $tar is a valid prefix\n"; |
557 |
$fh->print($val); |
$fh->print($val); |
558 |
index_pod(file => $path, parent => $parent, |
index_pod(file => $path, parent => $parent, |
559 |
text => $val, source => $ARCHIVE{$tar}, |
text => $val, source => $ARCHIVE{$tar}, |
|
mdate => $parent_mdate, |
|
560 |
); |
); |
561 |
} |
} |
562 |
} |
} |
665 |
$record->{size} = length($parm{'text'}); |
$record->{size} = length($parm{'text'}); |
666 |
my $headline = $record->{name} || $did; |
my $headline = $record->{name} || $did; |
667 |
|
|
668 |
|
# additional fields for Hyper Estraier |
669 |
$record->{'@mdate'} = $parm{'mdate'} if ($parm{'mdate'}); |
$record->{'@mdate'} = $parm{'mdate'} if ($parm{'mdate'}); |
670 |
|
|
671 |
$headline =~ s/^$DATA//o; # $did |
$headline =~ s/^$DATA//o; # $did |
677 |
headline => $headline, |
headline => $headline, |
678 |
%{$record}); |
%{$record}); |
679 |
} else { |
} else { |
680 |
|
foreach (keys %{$parm{parent}}) { |
681 |
|
next if (/^_/); |
682 |
|
$record->{$_} = $parm{parent}->{$_} if ($parm{parent}->{$_}); |
683 |
|
} |
684 |
$tb->insert('docid' => $did, |
$tb->insert('docid' => $did, |
685 |
headline => $headline, |
headline => $headline, |
686 |
source => $parm{source}, |
source => $parm{source}, |
687 |
parent => $parm{parent}, |
parent => $parm{parent}->{_id}, |
688 |
%{$record}); |
%{$record}); |
689 |
} |
} |
690 |
} |
} |
783 |
} |
} |
784 |
} |
} |
785 |
|
|
|
sub create_table { |
|
|
my %parm = @_; |
|
|
|
|
|
my $access = bless {}, 'WAIT::Document::Find'; |
|
|
|
|
|
my $stem = [{ |
|
|
'prefix' => ['isotr', 'isolc'], |
|
|
'intervall' => ['isotr', 'isolc'], |
|
|
}, 'isotr', 'isolc', 'split2', 'stop', 'Stem']; |
|
|
my $text = [{ |
|
|
'prefix' => ['isotr', 'isolc'], |
|
|
'intervall' => ['isotr', 'isolc'], |
|
|
}, |
|
|
'isotr', 'isolc', 'split2', 'stop']; |
|
|
my $sound = ['isotr', 'isolc', 'split2', 'Soundex'],; |
|
|
|
|
|
my $tb = |
|
|
$parm{db}->create_table |
|
|
(name => $parm{table}, |
|
|
attr => ['docid', 'headline', 'source', 'size', 'parent'], |
|
|
keyset => [['docid']], |
|
|
layout => $parm{layout}, |
|
|
access => $access, |
|
|
invindex => |
|
|
[ |
|
|
'name' => $stem, |
|
|
'synopsis' => $stem, |
|
|
'bugs' => $stem, |
|
|
'description' => $stem, |
|
|
'text' => $stem, |
|
|
'environment' => $text, |
|
|
'example' => $text, 'example' => $stem, |
|
|
'author' => $sound, 'author' => $stem, |
|
|
] |
|
|
); |
|
|
die "Could not create table '$parm{table}'" unless $tb; |
|
|
$tb; |
|
|
} |
|
|
|
|
786 |
my %MON; |
my %MON; |
787 |
my $YEAR; |
my $YEAR; |
788 |
|
|