/usr/share/perl5/Plucene/Search/HitCollector.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 | package Plucene::Search::HitCollector;
=head1 NAME
Plucene::Search::HitCollector
=head1 SYNOPSIS
# used in conjunction with the IndexSearcher
my $searcher = Plucene::Search::IndexSearcher->new($DIRECTORY);
my $hc = Plucene::Search::HitCollector->new( collect =>
sub {
my ($self, $doc, $score) = @_;
...
});
$searcher->search_hc($QUERY, $hc);
=head1 DESCRIPTION
This is used in conjunction with the IndexSearcher, in that whenever a
non-zero scoring document is found, the subref with with the HitCollector
was made will get called.
=head1 METHODS
=cut
=head2 new
my $hc = Plucene::Search::HitCollector->new( collect =>
sub {
my ($self, $doc, $score) = @_;
...
});
This will create a new Plucene::Search::HitCollector with the passed subref.
=cut
use strict;
use warnings;
use Carp qw/confess/;
# We're having to fake up singleton methods here.
sub new {
my ($self, %stuff) = @_;
if (!exists $stuff{collect}) {
confess("Need to supply definition of collect method");
}
bless \%stuff, $self;
}
=head2 collect
This is called once for every non-zero scoring document, with the document
number and its score.
=cut
sub collect { shift->{collect}->(@_) }
1;
|