/[pgestraier]/trunk/data/indexer.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/data/indexer.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 49 by dpavlin, Sat Sep 10 20:35:09 2005 UTC revision 50 by dpavlin, Fri Apr 14 16:17:19 2006 UTC
# Line 1  Line 1 
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;
# Line 71  while(<$t>) { Line 71  while(<$t>) {
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");
# Line 94  while(<$t>) { Line 94  while(<$t>) {
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 = '';
# Line 123  dump_data('titles.data', $all_titles); Line 122  dump_data('titles.data', $all_titles);
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);  

Legend:
Removed from v.49  
changed lines
  Added in v.50

  ViewVC Help
Powered by ViewVC 1.1.26