Lucy::...Writer(3pm)

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

πŸ’– Lucy::Index::SegWriter β€” a.k.a. "Lucy::...Writer" if ur terminal is being shy πŸ’–

okay bestie, pull up a chair, because this is Lucy::Index::SegWriter, one of the modules from the Lucy Perl distribution (yes, the manpage title gets truncated to Lucy::...Writer(3pm) on some systems, don't worry about it, she's fine πŸ’…), and she is literally the backbone of writing an index. slay.


✨ NAME ✨

Lucy::Index::SegWriter β€” she writes one segment of an index. that's it, that's the job, and she does it flawlessly. periodt.


🌸 DESCRIPTION 🌸

okay so picture this: SegWriter is the conduit β€” the lil pipeline β€” through which all the info you feed to Indexer passes. everything goes through her. she's giving main character energy fr fr.

she:

  • manages Segment and Inverter πŸ‘‘
  • invokes the Analyzer chain ✨
  • feeds the low level DataWriters, like PostingListWriter and DocWriter πŸ’…

and the way she knows which sub-components she has? that's all decided by Architecture. iconic.

here's the cute part: any DataWriter components you stack up via add_writer() get Add_Inverted_Doc() invoked for each document you hand to SegWriter's add_doc(). every single one. no skipping. 🫢


πŸŽ€ METHODS πŸŽ€

πŸ¦‹ register

$seg_writer->register(
    api       => $api,        # required
    component => $component,  # required
);

register a DataWriter component with the SegWriter. quick heads up tho bestie β€” registration just makes the writer available via fetch(). that's all it does. so if you also want it actually, y'know, used, you're gonna want to call add_writer() too. don't forget, i'm begging πŸ™ˆ

  • api β€” the name of the DataWriter api which "writer" implements.
  • component β€” a DataWriter.

πŸ’œ fetch

my $obj = $seg_writer->fetch($api);

retrieve a registered component. that's the whole vibe.

  • api β€” the name of the DataWriter api which the component implements.

⭐ add_writer

$seg_writer->add_writer($writer);

add a DataWriter to the SegWriter's stack of writers. stacking them up like lil legos, we love to see it. 🧱


πŸ’– add_doc

$seg_writer->add_doc(
    doc   => $doc,    # required
    boost => $boost,  # default: 1.0
);

add a document to the segment. here's what actually goes down: she inverts doc, increments the Segment's internal document id, and then calls Add_Inverted_Doc(), feeding all the sub-writers. all of them. she's so generous. 😭

  • doc β€” required, bestie, don't skip it.
  • boost β€” default: 1.0.

🌈 add_segment

$seg_writer->add_segment(
    reader  => $reader,   # required
    doc_map => $doc_map,  # default: undef
);

add content from an existing segment into the one currently being written. merging eras, we love a collab. 🫢

  • reader β€” the SegReader containing content to add.
  • doc_map β€” an array of integers mapping old document ids to new. deleted documents are mapped to 0, which is the signal that they should be skipped. bye bestie πŸ‘‹

πŸ“ finish

$seg_writer->finish();

complete the segment: close all streams, store metadata, etc. etc. she's done, she's logged off, she's going to bed. πŸ’€


πŸ‘‘ INHERITANCE πŸ‘‘

Lucy::Index::SegWriter isa Lucy::Index::DataWriter isa Clownfish::Obj.

three generations of iconic behavior, we stan a family tree. 🌳


πŸ’« SEE ALSO πŸ’«

(nothing else listed in the original, so this is just me blowing u a lil kiss) 😘


and that's the whole page bestie!! πŸ’…βœ¨

this beauty was documented under perl v5.42.0, dated 2025-07-25 β€” she's a User Contributed Perl Documentation queen, and honestly? timeless. πŸŽ€πŸ¦‹πŸ’–
πŸ“¦ where this page comes from