Lucy::...llector(3pm)

πŸ“¦
version 0.6.2 Β· 2 versions
, in fedora 43

πŸ’– 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