1 package Search
::Xapian
::PositionIterator
;
7 use Scalar
::Util
'blessed';
11 our @ISA = qw(DynaLoader);
13 # Preloaded methods go here.
15 # In a new thread, copy objects of this class to unblessed, undef values.
18 use overload
'++' => sub { $_[0]->inc() },
19 '=' => sub { $_[0]->clone() },
20 'eq' => sub { $_[0]->equal($_[1]) },
21 'ne' => sub { $_[0]->nequal($_[1]) },
22 '==' => sub { $_[0]->equal($_[1]) },
23 '!=' => sub { $_[0]->nequal($_[1]) },
24 '""' => sub { $_[0]->get_description() },
25 '0+' => sub { $_[0]->get_termpos() },
30 my $class = ref( $self );
31 my $copy = new2
( $self );
37 my ($self, $other) = @_;
38 if( blessed
($other) && $other->isa('Search::Xapian::PositionIterator') ) {
39 $self->equal1($other);
41 ($self+0) == ($other+0);
46 my ($self, $other) = @_;
47 if( blessed
($other) && $other->isa('Search::Xapian::PositionIterator') ) {
48 $self->nequal1($other);
50 ($self+0) != ($other+0);
59 if( scalar(@_) == 0 ) {
61 } elsif( scalar(@_) == 1 and ref( $_[1] ) eq $class ) {
67 Carp
::carp
( "USAGE: $class->new(), $class->new(\$iterator)" );
70 bless $iterator, $class;
80 Search::Xapian::PositionIterator - Iterate over sets of positions.
84 This iterator represents a stream of positions for a term. It overloads
85 C<++> for advancing the iterator, or you can explicitly call the C<inc> method.
86 This class also overloads C<eq>, C<ne>, C<==>, C<!=>, C<"">
87 (stringification) and C<0+> (conversion to an integer).
95 Constructor. Defaults to an uninitialized iterator.
101 Advance the iterator by one. (Called implictly by C<++> overloading).
103 =item skip_to <termpos>
105 Skip the iterator to term position termpos, or the first term position after
106 termpos if termpos isn't in the list of term positions being iterated.
110 Checks if a term is the same as this term. Also overloaded to the C<eq>
115 Checks if a term is different from this term. Also overloaded to the C<ne>
120 Return the term position the iterator is currently on. Also implemented as
121 conversion to an integer.
123 =item get_description
125 Return a description of this object. Also implemented as stringification.
132 L<Search::Xapian::Document>