| Use Case | Command | Description |
|---|---|---|
| Create a collector | my $hc = Plucene::Search::HitCollector->new(collect => sub { ... }); | Pass a callback that receives each nonβzero scoring document |
| Search with collector | $searcher->search_hc($query, $hc); | Run the query and feed results to the collector |
| Callback signature | sub { my ($self, $doc, $score) = @_; ... } | The callback receives the document number and its score |
# 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);
This is used in conjunction with the IndexSearcher, in that whenever a nonβzero scoring document is found, the subref with which the HitCollector was made will get called.
my $hc = Plucene::Search::HitCollector->new( collect =>
sub {
my ($self, $doc, $score) = @_;
...
});
This will create a new Plucene::Search::HitCollector with the passed subref.
This is called once for every nonβzero scoring document, with the document number and its score.
Generated by phpman v4.9.29 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-20 17:58 @2600:1f28:365:80b0:8802:8bb4:3873:328e
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format