| Plucene documentation | Contained in the Plucene distribution. |
Plucene::Index::SegmentTermPositions - Segment term positions
# isa Plucene::Index::SegmentTermDocs $seg_term_pos->skipping_doc; my $next = $seg_term_pos->next_position;
This is the segment term positions class.
my $seg_term_pos = Plucene::Index::SegmentTermPositions ->new(Plucene::Index::SegmentReader $seg_reader); =cut
$seg_term_pos->close;
my $next = $seg_term_pos->next_position;
$seg_term_pos->skipping_doc;
This should not be called
| Plucene documentation | Contained in the Plucene distribution. |
package Plucene::Index::SegmentTermPositions; # final class SegmentTermPositions # extends SegmentTermDocs implements TermPositions
use strict; use warnings; use Carp; use base 'Plucene::Index::SegmentTermDocs'; __PACKAGE__->mk_accessors(qw(_prox_stream _prox_count)); # private InputStream proxStream; # private int proxCount; # private int position;
# SegmentTermPositions(SegmentReader p) throws IOException { # super(p); # this.proxStream = (InputStream)parent.proxStream.clone(); # } sub new { my $self = shift->SUPER::new(@_); $self->{_prox_stream} = $self->parent->prox_stream; $self->{_prox_ptr} = 0; $self->{_prox_count} = 0; return $self; } # final void seek(TermInfo ti) throws IOException { # super.seek(ti); # if (ti != null) # proxStream.seek(ti.proxPointer); # else # proxCount = 0; # } sub _seek { my ($self, $ti) = @_; $self->SUPER::_seek($ti); if ($ti) { $self->{_prox_ptr} = $ti->prox_pointer; } else { $self->{_prox_count} = 0; } }
# public final void close() throws IOException { # super.close(); # proxStream.close(); # }
# public final int nextPosition() throws IOException { # proxCount--; # return position += proxStream.readVInt(); # } sub next_position { my $self = shift; $self->{_prox_count}--; return $self->{position} += $self->{_prox_stream}->[ $self->{_prox_ptr}++ ]; }
# protected final void skippingDoc() throws IOException { # for (int f = freq; f > 0; f--) // skip all positions # proxStream.readVInt(); # } sub skipping_doc { my $self = shift; $self->{_prox_ptr} += $self->freq; } # public final boolean next() throws IOException { # for (int f = proxCount; f > 0; f--) // skip unread positions # proxStream.readVInt(); # # if (super.next()) { // run super # proxCount = freq; // note frequency # position = 0; // reset position # return true; # } # return false; # } sub next { my $self = shift; $self->{_prox_ptr} += $self->{_prox_count}; if ($self->SUPER::next()) { $self->{_prox_count} = $self->freq; $self->{position} = 0; return 1; } return; }
# public final int read(final int[] docs, final int[] freqs) # throws IOException { # throw new RuntimeException(); # } sub read { croak "'read' should not be called" } 1;