line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plucene::Index::SegmentTermPositions; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# final class SegmentTermPositions |
4
|
|
|
|
|
|
|
# extends SegmentTermDocs implements TermPositions |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Plucene::Index::SegmentTermPositions - Segment term positions |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# isa Plucene::Index::SegmentTermDocs |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$seg_term_pos->skipping_doc; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $next = $seg_term_pos->next_position; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This is the segment term positions class. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
18
|
|
|
18
|
|
104
|
use strict; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
656
|
|
27
|
18
|
|
|
18
|
|
104
|
use warnings; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
653
|
|
28
|
|
|
|
|
|
|
|
29
|
18
|
|
|
18
|
|
95
|
use Carp; |
|
18
|
|
|
|
|
33
|
|
|
18
|
|
|
|
|
1235
|
|
30
|
|
|
|
|
|
|
|
31
|
18
|
|
|
18
|
|
98
|
use base 'Plucene::Index::SegmentTermDocs'; |
|
18
|
|
|
|
|
41
|
|
|
18
|
|
|
|
|
8624
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(_prox_stream _prox_count)); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# private InputStream proxStream; |
36
|
|
|
|
|
|
|
# private int proxCount; |
37
|
|
|
|
|
|
|
# private int position; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $seg_term_pos = Plucene::Index::SegmentTermPositions |
42
|
|
|
|
|
|
|
->new(Plucene::Index::SegmentReader $seg_reader); |
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# SegmentTermPositions(SegmentReader p) throws IOException { |
46
|
|
|
|
|
|
|
# super(p); |
47
|
|
|
|
|
|
|
# this.proxStream = (InputStream)parent.proxStream.clone(); |
48
|
|
|
|
|
|
|
# } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub new { |
51
|
302
|
|
|
302
|
1
|
3394
|
my $self = shift->SUPER::new(@_); |
52
|
302
|
|
|
|
|
4163
|
$self->{_prox_stream} = $self->parent->prox_stream; |
53
|
302
|
|
|
|
|
2578
|
$self->{_prox_ptr} = 0; |
54
|
302
|
|
|
|
|
530
|
$self->{_prox_count} = 0; |
55
|
302
|
|
|
|
|
2068
|
return $self; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# final void seek(TermInfo ti) throws IOException { |
59
|
|
|
|
|
|
|
# super.seek(ti); |
60
|
|
|
|
|
|
|
# if (ti != null) |
61
|
|
|
|
|
|
|
# proxStream.seek(ti.proxPointer); |
62
|
|
|
|
|
|
|
# else |
63
|
|
|
|
|
|
|
# proxCount = 0; |
64
|
|
|
|
|
|
|
# } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _seek { |
67
|
33143
|
|
|
33143
|
|
45142
|
my ($self, $ti) = @_; |
68
|
33143
|
|
|
|
|
94281
|
$self->SUPER::_seek($ti); |
69
|
33143
|
50
|
|
|
|
189598
|
if ($ti) { |
70
|
33143
|
|
|
|
|
77967
|
$self->{_prox_ptr} = $ti->prox_pointer; |
71
|
|
|
|
|
|
|
} else { |
72
|
0
|
|
|
|
|
0
|
$self->{_prox_count} = 0; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 close |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$seg_term_pos->close; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# public final void close() throws IOException { |
83
|
|
|
|
|
|
|
# super.close(); |
84
|
|
|
|
|
|
|
# proxStream.close(); |
85
|
|
|
|
|
|
|
# } |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 next_position |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $next = $seg_term_pos->next_position; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# public final int nextPosition() throws IOException { |
94
|
|
|
|
|
|
|
# proxCount--; |
95
|
|
|
|
|
|
|
# return position += proxStream.readVInt(); |
96
|
|
|
|
|
|
|
# } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub next_position { |
99
|
144593
|
|
|
144593
|
1
|
166054
|
my $self = shift; |
100
|
144593
|
|
|
|
|
192729
|
$self->{_prox_count}--; |
101
|
144593
|
|
|
|
|
459602
|
return $self->{position} += $self->{_prox_stream}->[ $self->{_prox_ptr}++ ]; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 skipping_doc |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$seg_term_pos->skipping_doc; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# protected final void skippingDoc() throws IOException { |
111
|
|
|
|
|
|
|
# for (int f = freq; f > 0; f--) // skip all positions |
112
|
|
|
|
|
|
|
# proxStream.readVInt(); |
113
|
|
|
|
|
|
|
# } |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub skipping_doc { |
116
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
117
|
0
|
|
|
|
|
0
|
$self->{_prox_ptr} += $self->freq; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# public final boolean next() throws IOException { |
121
|
|
|
|
|
|
|
# for (int f = proxCount; f > 0; f--) // skip unread positions |
122
|
|
|
|
|
|
|
# proxStream.readVInt(); |
123
|
|
|
|
|
|
|
# |
124
|
|
|
|
|
|
|
# if (super.next()) { // run super |
125
|
|
|
|
|
|
|
# proxCount = freq; // note frequency |
126
|
|
|
|
|
|
|
# position = 0; // reset position |
127
|
|
|
|
|
|
|
# return true; |
128
|
|
|
|
|
|
|
# } |
129
|
|
|
|
|
|
|
# return false; |
130
|
|
|
|
|
|
|
# } |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub next { |
133
|
66539
|
|
|
66539
|
1
|
89108
|
my $self = shift; |
134
|
66539
|
|
|
|
|
112636
|
$self->{_prox_ptr} += $self->{_prox_count}; |
135
|
66539
|
100
|
|
|
|
199458
|
if ($self->SUPER::next()) { |
136
|
33403
|
|
|
|
|
79791
|
$self->{_prox_count} = $self->freq; |
137
|
33403
|
|
|
|
|
143604
|
$self->{position} = 0; |
138
|
33403
|
|
|
|
|
104778
|
return 1; |
139
|
|
|
|
|
|
|
} |
140
|
33136
|
|
|
|
|
305040
|
return; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 read |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This should not be called |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# public final int read(final int[] docs, final int[] freqs) |
150
|
|
|
|
|
|
|
# throws IOException { |
151
|
|
|
|
|
|
|
# throw new RuntimeException(); |
152
|
|
|
|
|
|
|
# } |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
0
|
1
|
|
sub read { croak "'read' should not be called" } |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |