Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Plucene::Search::HitCollector

Name Plucene::Search::HitCollector
Version
Located at /usr/share/perl5
File /usr/share/perl5/Plucene/Search/HitCollector.pm
Is Core No
Search CPAN for this module Plucene::Search::HitCollector
Documentation Plucene::Search::HitCollector
Module Details Plucene::Search::HitCollector

NAME

Plucene::Search::HitCollector


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.


METHODS

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; }

collect

This is called once for every non-zero scoring document, with the document number and its score.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026