hitcollector.pm

来自「Plucene-1.25.tar.gz PERL版本的lucene」· PM 代码 · 共 68 行

PM
68
字号
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 DESCRIPTIONThis is used in conjunction with the IndexSearcher, in that whenever a non-zero scoring document is found, the subref with with the HitCollectorwas 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.		=cutuse 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 collectThis is called once for every non-zero scoring document, with the document number and its score.=cutsub collect { shift->{collect}->(@_) }1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?