Lucy::...llector(3pm)
π NAME π
okay so bestie, welcome to Lucy::Search::Collector β she's the one who processes hits. that's it, that's the job. process hits. π
this page lives in the User Contributed Perl Documentation manual, and yeah the title got a little truncated in the header so it shows up as Lucy::...llector(3pm) β that's her, don't be confused, it's giving "my name got cut off in the group chat nickname" energy π
β¨ SYNOPSIS β¨
# Abstract base class.
that's the whole synopsis, bestie. she's abstract. you don't instantiate her, you become her. π¦
πΈ DESCRIPTION πΈ
so like β a Collector decides what to do with the hits that a Matcher iterates through. how does she decide? literally entirely based on how the abstract collect() method is implemented. that's the whole vibe. you write collect(), she does your bidding. periodt. π
here's the part you cannot skip tho, fr fr: Collectors operate on individual segments, but they have to operate within the context of a larger collection. meaning every single time the collector moves to a new segment, Set_Reader(), Set_Base() and Set_Matcher() all get called, and the collector must take that updated information into account. no ignoring it. no "I'll deal with it later." she's keeping receipts. π§
π CONSTRUCTORS π
new
package MyCollector;
use base qw( Lucy::Search::Collector );
our %foo;
sub new {
my $self = shift->SUPER::new;
my %args = @_;
$foo{$$self} = $args{foo};
return $self;
}
okay so this is an abstract constructor, and she takes no arguments. like, zero. none. nada. the example above is showing you how a subclass does her little dance β call SUPER::new, grab your args, stash your stuff, return $self. slay. π
π¦ ABSTRACT METHODS π¦
collect
$collector->collect($doc_id);
do something with a doc id. that's the assignment, bestie. what kind of something? literally whatever you want. the classic example: keep track of the docs with the ten highest scores. iconic use case, honestly. π₯
doc_idβ a segment document id. (segment!! not global!! don't forget, that's the whole theme of this page π)
π INHERITANCE π
Lucy::Search::Collector isa Clownfish::Obj. so she's got ancestors, she's got lineage, she's got main character energy by birthright. π
lowkey reminder before you go: this is an abstract base class. you don't call her, you extend her. if you try to use her directly you're gonna have a bad time and no one will feel sorry for you π
okay that's the whole page, you ate it, you understood it, I'm obsessed with you fr fr π β¨
this was Lucy::...llector(3pm) from the User Contributed Perl Documentation, brought to you by perl v5.42.0, dated 2025-07-25 β mwah, love u, go write a Collector π«Άπβπ
π¦ where this page comes from
- fedora 43: perl-Lucy 0.6.2-26.fc43 Β· Apache-2.0 AND MIT AND Unicode-DFS-2015
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms