line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package KinoSearch1::Index::TermInfosWriter; |
2
|
34
|
|
|
34
|
|
189
|
use strict; |
|
34
|
|
|
|
|
76
|
|
|
34
|
|
|
|
|
1330
|
|
3
|
34
|
|
|
34
|
|
186
|
use warnings; |
|
34
|
|
|
|
|
86
|
|
|
34
|
|
|
|
|
844
|
|
4
|
34
|
|
|
34
|
|
181
|
use KinoSearch1::Util::ToolSet; |
|
34
|
|
|
|
|
266
|
|
|
34
|
|
|
|
|
4775
|
|
5
|
34
|
|
|
34
|
|
201
|
use base qw( KinoSearch1::Util::Class ); |
|
34
|
|
|
|
|
87
|
|
|
34
|
|
|
|
|
3255
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
34
|
|
|
34
|
|
301
|
__PACKAGE__->init_instance_vars( |
9
|
|
|
|
|
|
|
# constructor params |
10
|
|
|
|
|
|
|
invindex => undef, |
11
|
|
|
|
|
|
|
seg_name => undef, |
12
|
|
|
|
|
|
|
is_index => 0, |
13
|
|
|
|
|
|
|
index_interval => 1024, |
14
|
|
|
|
|
|
|
skip_interval => 16, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
our %instance_vars; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
124
|
|
|
124
|
1
|
365
|
my $class = shift; |
21
|
124
|
50
|
|
|
|
511
|
confess kerror() unless verify_args( \%instance_vars, @_ ); |
22
|
124
|
|
|
|
|
895
|
my %args = ( %instance_vars, @_ ); |
23
|
124
|
|
|
|
|
298
|
my $invindex = $args{invindex}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# open an outstream |
26
|
124
|
100
|
|
|
|
358
|
my $suffix = $args{is_index} ? 'tii' : 'tis'; |
27
|
124
|
|
|
|
|
295
|
my $filename = "$args{seg_name}.$suffix"; |
28
|
124
|
50
|
|
|
|
436
|
$invindex->delete_file($filename) if $invindex->file_exists($filename); |
29
|
124
|
|
|
|
|
1494
|
my $outstream = $args{invindex}->open_outstream($filename); |
30
|
|
|
|
|
|
|
|
31
|
124
|
|
|
|
|
1169
|
my $self = _new( $outstream, |
32
|
|
|
|
|
|
|
@args{qw( is_index index_interval skip_interval )} ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# create the tii doppelganger |
35
|
124
|
100
|
|
|
|
404
|
if ( !$args{is_index} ) { |
36
|
62
|
|
|
|
|
495
|
my $other = __PACKAGE__->new( |
37
|
|
|
|
|
|
|
invindex => $invindex, |
38
|
|
|
|
|
|
|
seg_name => $args{seg_name}, |
39
|
|
|
|
|
|
|
is_index => 1, |
40
|
|
|
|
|
|
|
); |
41
|
62
|
|
|
|
|
421
|
$self->_set_other($other); |
42
|
62
|
|
|
|
|
235
|
$other->_set_other($self); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
124
|
|
|
|
|
515
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub finish { |
49
|
124
|
|
|
124
|
0
|
235
|
my $self = shift; |
50
|
124
|
|
|
|
|
449
|
my $outstream = $self->_get_outstream; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# seek to near the head and write the number of terms processed |
53
|
124
|
|
|
|
|
1691
|
$outstream->seek(4); |
54
|
124
|
|
|
|
|
831
|
$outstream->lu_write( 'Q', $self->_get_size ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# cue the doppelganger's exit |
57
|
124
|
100
|
|
|
|
587
|
if ( !$self->_get_is_index ) { |
58
|
62
|
|
|
|
|
418
|
$self->_get_other()->finish; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
124
|
|
|
|
|
409
|
$outstream->close; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |