/[Semantic-Engine]/EPrints/index.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 /EPrints/index.pl

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

revision 13 by dpavlin, Fri Jun 29 18:46:45 2007 UTC revision 14 by dpavlin, Fri Jun 29 22:54:51 2007 UTC
# Line 10  use lib '/home/dpavlin/stem-hr/'; Line 10  use lib '/home/dpavlin/stem-hr/';
10  use StemHR;  use StemHR;
11    
12  my $debug = shift @ARGV;  my $debug = shift @ARGV;
13    my $use_score = 0;
14    
15  my $dbh = EPrints->dbh;  my $dbh = EPrints->dbh;
16  my $sth = $dbh->prepare(qq{  my $sth = $dbh->prepare(qq{
# Line 38  my $total = 0; Line 39  my $total = 0;
39    
40  while (my $row = $sth->fetchrow_hashref ) {  while (my $row = $sth->fetchrow_hashref ) {
41          EPrints->id( $row->{id} );          EPrints->id( $row->{id} );
42          my ( $title, $keywords, $abstract ) = (          my $parts = {
43                  _x( $row->{title} ),                  title => [ _x( $row->{title} ), 4 ],
44                  EPrints->lookup( 'keywords' ),                  keywords => [ EPrints->lookup( 'keywords' ), 3 ],
45                  EPrints->lookup( 'abstract' )                  abstract => [ EPrints->lookup( 'abstract' ), 2 ],
46          );  #               content => [ EPrints->fulltext_content, 1 ],
47          my @body = split( /\W*\s+\W*/, "$title $title $title $keywords $keywords $abstract" );          };
         my $body = '';  
         foreach my $word ( @body ) {  
                 $body .= StemHR->stem( $word ) . ' ';  
         }  
   
         $body .= EPrints::slogovi( "$title $keywords $abstract" );  
48    
49          warn "body: $body\n" if $debug;          my $body = '';
50    
51          $body .= EPrints->fulltext_content;          foreach my $part ( qw/title keywords abstract content/ ) {
52                    my $content = $parts->{$part}->[0];
53                    next unless defined $content;
54                    
55    #               $content = StemHR->stem( $content );
56                    $content = EPrints->slogovi( $content );
57    
58                    if ( $use_score ) {
59                            map { $body .= $content } 1 .. $parts->{$part}->[1];
60                    } else {
61                            $body .= $content;
62                    }
63            }
64    
65          $indexer->index( $row->{id}, join(" ", @body, $body ) );          $indexer->index( $row->{id}, $body );
66          $total++;          $total++;
67          print STDERR _x( $row->{id}, " ", $row->{title} ), "\n";          print STDERR "$total: ", $row->{id}, " ", _x( $row->{title} ), " - ", length($body), " bytes\n";
68  }  }
69    
70    

Legend:
Removed from v.13  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.26