1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use strict; |
use strict; |
4 |
use HyperEstraier; |
use Search::Estraier; |
5 |
|
|
6 |
# score for words in title |
# score for words in title |
7 |
my $title_rank = 3; |
my $title_rank = 3; |
8 |
|
|
9 |
open(my $t, "gzip -cd trivia.list.gz |") || die "can't open trivia.list.gz: $!"; |
open(my $t, "gzip -cd trivia.list.gz |") || die "can't open trivia.list.gz: $!"; |
10 |
|
|
|
# open the database |
|
|
my $db = HyperEstraier::Database->new(); |
|
|
$db->open('casket', $HyperEstraier::Database::DBWRITER | $HyperEstraier::Database::DBCREAT); |
|
11 |
# open node |
# open node |
12 |
my $node = HyperEstraier::Node->new("http://localhost:1978/node/trivia"); |
my $node = Search::Estraier::Node->new( |
13 |
$node->set_auth('admin', 'admin'); |
url => 'http://localhost:1978/node/trivia', |
14 |
|
user => 'admin', |
15 |
|
passwd => 'admin', |
16 |
|
); |
17 |
|
|
18 |
|
|
19 |
my $header = 1; |
my $header = 1; |
71 |
print "$i "; |
print "$i "; |
72 |
|
|
73 |
# create a document object |
# create a document object |
74 |
my $doc = HyperEstraier::Document->new; |
my $doc = Search::Estraier::Document->new; |
75 |
|
|
76 |
# add attributes to the document object |
# add attributes to the document object |
77 |
$doc->add_attr('@uri', "file://localhost/trivia/$i"); |
$doc->add_attr('@uri', "file://localhost/trivia/$i"); |
94 |
|
|
95 |
|
|
96 |
# register the document object to the database |
# register the document object to the database |
|
$db->put_doc($doc, $HyperEstraier::Database::PDCLEAN); |
|
97 |
$node->put_doc($doc); |
$node->put_doc($doc); |
98 |
|
|
99 |
$trivia = ''; |
$trivia = ''; |
122 |
dump_data('quotes.data', $all_quotes); |
dump_data('quotes.data', $all_quotes); |
123 |
dump_data('years.data', $all_years); |
dump_data('years.data', $all_years); |
124 |
|
|
|
$db->sync(); |
|
|
|
|
|
#print "\noptimizing...\n"; |
|
|
#$db->optimize(0); |
|