2e02d9cc047bbbe5332e2aa429ff135af3988970
[idzebra-moved-to-github.git] / perl / lib / IDZebra / ScanEntry.pm
1 # $Id: ScanEntry.pm,v 1.3 2003-03-12 17:08:53 pop Exp $
2
3 # Zebra perl API header
4 # =============================================================================
5 package IDZebra::ScanEntry;
6
7 use strict;
8 use warnings;
9
10 BEGIN {
11     use IDZebra;
12     use IDZebra::Logger qw(:flags :calls);
13     use Scalar::Util qw(weaken);
14     use Carp;
15     our $VERSION = do { my @r = (q$Revision: 1.3 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; 
16 }
17
18 use constant _term        => 0;
19 use constant _occurrences => 1;
20 use constant _position    => 2;
21 use constant _list        => 3;
22 1;
23
24 # -----------------------------------------------------------------------------
25 # Class constructors, destructor
26 # -----------------------------------------------------------------------------
27
28
29 sub new {
30     my ($proto,@args) = @_;
31     my $class = ref($proto) || $proto;
32     my $self = \@args;
33     bless ($self, $class);
34     weaken ($self->[_list]);
35     return ($self);
36 }
37
38 # =============================================================================
39 sub DESTROY {
40     my $self = shift;
41 #    logf(LOG_LOG,"DESTROY: IDZebra::ScanEntry");
42 }
43
44 # -----------------------------------------------------------------------------
45 sub term {
46     my $self = shift;
47     return ($self->[_term]);
48 }
49
50 sub occurrences {
51     my $self = shift;
52     return ($self->[_occurrences]);
53 }
54
55 sub position {
56     my $self = shift;
57     return ($self->[_position]);
58 }
59
60
61
62 # -----------------------------------------------------------------------------
63 __END__
64
65 =head1 NAME
66
67 IDZebra::ScanEntry - An entry of the scan results
68
69 =head1 SYNOPSIS
70
71   foreach my $se ($sl->entries()) {
72       print STDERR ($se->position ,": ",
73                     $se->term() . " (",
74                     $se->occurrences() . "\n");
75   }
76  
77 =head1 DESCRIPTION
78
79 A scan entry describes occurrence of a term in the scanned index.
80
81 =head1 PROPERTIES
82
83 =over 4
84
85 =item B<term>
86
87 The term itself.
88
89 =item B<position>
90
91 Position of term in the list. 1 based.
92
93 =item B<occurrences>
94
95 The occurrence count of the term in the selected database(s).
96
97 =back 
98
99 =head1 TODO
100
101 A I<resultSet> and maybe a I<records> method, to reach the records, where the term occurred.
102
103 =head1 COPYRIGHT
104
105 Fill in
106
107 =head1 AUTHOR
108
109 Peter Popovics, pop@technomat.hu
110
111 =head1 SEE ALSO
112
113 IDZebra, IDZebra::ScanList, Zebra documentation
114
115 =cut