1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
# -*- Mode: Perl -*- |
# -*- Mode: Perl -*- |
3 |
# $Basename$ |
# $Basename$ |
4 |
# $Revision: 1.6 $ |
# $Revision: 1.8 $ |
5 |
# Author : Ulrich Pfeifer |
# Author : Ulrich Pfeifer |
6 |
# Created On : Mon Dec 31 13:57:11 2001 |
# Created On : Mon Dec 31 13:57:11 2001 |
7 |
# Last Modified By: Ulrich Pfeifer |
# Last Modified By: Ulrich Pfeifer |
11 |
# (C) Copyright 2001, UUNET Deutschland GmbH, Germany |
# (C) Copyright 2001, UUNET Deutschland GmbH, Germany |
12 |
# |
# |
13 |
|
|
14 |
|
use 5.007; |
15 |
|
|
16 |
use strict; |
use strict; |
17 |
|
use Devel::Peek qw(Dump); |
18 |
|
|
19 |
use File::Path; |
use File::Path; |
20 |
use DB_File; |
use DB_File; |
21 |
use Getopt::Long; |
use Getopt::Long; |
22 |
use Cwd; |
use Cwd; |
23 |
|
|
24 |
require WAIT::Config; |
BEGIN {require WAIT::Config;} |
25 |
require WAIT::Database; |
use WAIT::Database; |
26 |
require WAIT::Parse::Ora; |
use WAIT::Parse::Ora; |
27 |
require WAIT::Document::Ora; |
use WAIT::Document::Ora; |
28 |
require WAIT::InvertedIndex; |
use WAIT::InvertedIndex; |
29 |
|
|
30 |
|
|
31 |
$DB_BTREE->{'cachesize'} = 200_000 ; |
$DB_BTREE->{'cachesize'} = 200_000 ; |
52 |
|
|
53 |
my $layout = new WAIT::Parse::Ora; |
my $layout = new WAIT::Parse::Ora; |
54 |
|
|
55 |
my $stem = ['isotr', 'isolc', 'split2', 'stop', 'Stem']; |
use lib "/usr/local/apache/lib"; |
56 |
|
use oreilly_de_catalog::wait_handler; |
57 |
|
|
58 |
|
my $stem = ['OR_tr_20020124', 'OR_lc_20020124', 'split2', 'stop', 'Stem']; |
59 |
my $text = [{ |
my $text = [{ |
60 |
'prefix' => ['isotr', 'isolc'], |
'prefix' => ['OR_tr_20020124', 'OR_lc_20020124'], |
61 |
'intervall' => ['isotr', 'isolc'], |
'intervall' => ['OR_tr_20020124', 'OR_lc_20020124'], |
62 |
}, |
}, |
63 |
'isotr', 'isolc', 'split2', 'stop']; |
'OR_tr_20020124', 'OR_lc_20020124', 'split2', 'stop']; |
64 |
my $sound = ['isotr', 'isolc', 'split2', 'Soundex'],; |
my $sound = ['OR_tr_20020124', 'OR_lc_20020124', 'split2', 'Soundex']; |
65 |
|
my $trigr = ['OR_lc_20020124', 'OR_trigrams_20020125']; |
66 |
|
|
67 |
my $cwd = cwd; |
my $cwd = cwd; |
68 |
|
|
89 |
die "Couldn't create table $OPT{table}: $@\n" unless $tb; |
die "Couldn't create table $OPT{table}: $@\n" unless $tb; |
90 |
|
|
91 |
my ($did, $value); |
my ($did, $value); |
92 |
|
binmode STDOUT, ":utf8"; |
93 |
while (($did, $value) = each %D) { |
while (($did, $value) = each %D) { |
94 |
my $record = $layout->split($value); |
my $record = $layout->split($value); |
95 |
my $headline = $record->{title}; |
my $headline = $record->{title}; |
100 |
%{$record}); |
%{$record}); |
101 |
} |
} |
102 |
$tb->set(top=>1); |
$tb->set(top=>1); |
103 |
|
|
104 |
|
my $tritb = $db->create_table( |
105 |
|
name => "$OPT{table}_fallback", |
106 |
|
attr => [qw(docid headline)], |
107 |
|
invindex => [ headline => $trigr ], |
108 |
|
); |
109 |
|
my %dict; |
110 |
|
for my $f ($tb->fields) { |
111 |
|
my(@idx) = @{$tb->table->{inverted}{$f} || []}; |
112 |
|
for my $idx (@idx) { |
113 |
|
my @keys = $idx->keys; |
114 |
|
@dict{@keys} = (); |
115 |
|
} |
116 |
|
} |
117 |
|
my @dictkeys = grep s/^p//, keys %dict; |
118 |
|
my $maxdebug = 5; |
119 |
|
for my $headline (@dictkeys) { |
120 |
|
if ($maxdebug && $headline =~ /[^\040-\177]/) { |
121 |
|
Dump $headline; |
122 |
|
$maxdebug--; |
123 |
|
} |
124 |
|
$tritb->insert(docid => $headline, headline => $headline); |
125 |
|
} |
126 |
|
$tritb->set(top=>1); |
127 |
|
$tritb->close; |
128 |
$tb->close(); |
$tb->close(); |
129 |
$db->close(); |
$db->close(); |
130 |
|
|