5 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
6 |
|
|
7 |
use EPrints qw/_x/; |
use EPrints qw/_x/; |
8 |
|
use KinoSearch::Simple; |
9 |
|
|
10 |
my $debug = shift @ARGV; |
my $debug = shift @ARGV; |
11 |
my $use = { |
my $use = { |
41 |
|
|
42 |
my $total = 0; |
my $total = 0; |
43 |
|
|
44 |
|
my $kino = KinoSearch::Simple->new( |
45 |
|
path => 'kinoindex/', |
46 |
|
language => 'ru', |
47 |
|
); |
48 |
|
|
49 |
while (my $row = $sth->fetchrow_hashref ) { |
while (my $row = $sth->fetchrow_hashref ) { |
50 |
my $id = $row->{id}; |
my $id = $row->{id}; |
51 |
EPrints->id( $id ); |
EPrints->id( $id ); |
52 |
|
|
53 |
my $parts = { |
my $parts = { |
54 |
title => [ _x( $row->{title} ), 3 ], |
title => [ _x( $row->{title} ), 3 ], |
55 |
keywords => [ EPrints->lookup( 'keywords' ), 2 ], |
keywords => [ EPrints->lookup( 'keywords' ), 2 ], |
93 |
} |
} |
94 |
|
|
95 |
$indexer->index( $row->{id}, $body ); |
$indexer->index( $row->{id}, $body ); |
96 |
|
$kino->add_doc({ |
97 |
|
id => $id, |
98 |
|
title => $parts->{title}, |
99 |
|
keywords => $parts->{keywords}, |
100 |
|
abstract => $parts->{abstract}, |
101 |
|
}); |
102 |
|
|
103 |
$total++; |
$total++; |
104 |
print STDERR "$total: ", $row->{id}, " ", _x( $row->{title} ), " - ", length($body), " bytes\n"; |
print STDERR "$total: ", $row->{id}, " ", _x( $row->{title} ), " - ", length($body), " bytes\n"; |
105 |
} |
} |