Lucy::...Writer(3pm)
π 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
SegmentandInverterπ - invokes the
Analyzerchain β¨ - feeds the low level
DataWriters, likePostingListWriterandDocWriterπ
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 theDataWriterapi which"writer"implements.componentβ aDataWriter.
π fetch
my $obj = $seg_writer->fetch($api);
retrieve a registered component. that's the whole vibe.
apiβ the name of theDataWriterapi 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β theSegReadercontaining content to add.doc_mapβ an array of integers mapping old document ids to new. deleted documents are mapped to0, 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
- 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