/usr/share/perl5/Plucene/Search/PhrasePositions.pm is in libplucene-perl 1.25-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | package Plucene::Search::PhrasePositions;
=head1 NAME
Plucene::Search::PhrasePositions - The position of a phrase
=head1 SYNOPSIS
my $phpos = Plucene::Search::PhrasePositions->new;
my $next = $phpos->next;
my $first_pos = $phpos->first_position;
my $next_pos = $phpos->next_position;
=head1 DESCRIPTION
=head1 METHODS
=cut
use strict;
use warnings;
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(qw/ doc position count offset tp next_in_list /);
=head2 new
my $phpos = Plucene::Search::PhrasePositions->new;
Make a new Plucene::Search::PhrasePositions object.
=head2 doc / position / count / offset / tp / next
Get / set these attibutes.
=cut
sub new {
my $self = shift->SUPER::new(@_);
$self->{offset} ||= 0;
$self->{position} ||= 0;
$self->{count} ||= 0;
$self->next;
$self;
}
=head2 next
my $next = $phpos->next;
=cut
sub next {
my $self = shift;
if (!$self->{tp}->next) {
$self->doc(~0);
return;
}
$self->doc($self->tp->doc);
$self->position(0);
}
=head2 first_position
my $first = $phpos->first_position;
=cut
sub first_position {
my $self = shift;
$self->count($self->tp->freq);
$self->next_position;
}
=head2 next_position
my $next_pos = $phpos->next_position;
=cut
sub next_position {
my $self = shift;
return unless $self->{count}-- > 0;
$self->position($self->tp->next_position - $self->offset);
}
1;
|