Lucy::...Writer(3pm)

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

πŸ’– Lucy::Index::DeletionsWriter πŸ’–

okay bestie, so this page lives in the Lucy::...Writer(3pm) corner of the User Contributed Perl Documentation universe, and it's literally the blueprint energy for marking docs as deleted. abstract base class vibes only, no cap 🫢


✨ NAME ✨

Lucy::Index::DeletionsWriter β€” the abstract base class that marks documents as deleted. it's giving "parent class, do not instantiate me directly" πŸ’…


🌸 SYNOPSIS 🌸

my $polyreader  = $del_writer->get_polyreader;
my $seg_readers = $polyreader->seg_readers;
for my $seg_reader (@$seg_readers) {
    my $count = $del_writer->seg_del_count( $seg_reader->get_seg_name );
    ...
}

look at that loop. iconic. no notes. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so, subclasses of DeletionsWriter hand you a low-level mechanism for declaring a document deleted from an index. lowkey the whole point.

here's the tea though: files in an index are never modified, and it's just not practical to delete entire segments, so a DeletionsWriter does not actually remove documents from the index. not even a little. instead, it communicates to a search-time companion, DeletionsReader, which documents are deleted β€” and it does it in such a way that the reader can create a Matcher iterator. the way that works is honestly so clever 🧚

documents are truly deleted only when the segments which contain them get merged into new ones. periodt.


πŸŽ€ ABSTRACT METHODS πŸŽ€

πŸ’œ delete_by_term

$deletions_writer->delete_by_term(
    field => $field,  # required
    term  => $term,   # required
);

delete all documents in the index that index the supplied term. bye bestie πŸ‘‹

  • field β€” the name of an indexed field. (if it is not spec'd as "indexed", an error will occur. so like, don't.)
  • term β€” the term which identifies docs to be marked as deleted. if "field" is associated with an Analyzer, "term" will be processed automatically, so don't pre-process it yourself, okay? let the machine do its thing. πŸ™ˆ

🌈 delete_by_query

$deletions_writer->delete_by_query($query);

delete all documents in the index that match "query".

  • query β€” a Query.

⭐ updated

my $bool = $deletions_writer->updated();

returns true if there are updates that need to be written. vibe check on your pending writes, fr fr.

πŸ“ seg_del_count

my $int = $deletions_writer->seg_del_count($seg_name);

return the number of deletions for a given segment.

  • seg_name β€” the name of the segment.

πŸ‘‘ INHERITANCE πŸ‘‘

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

a whole lineage. main character family tree energy. πŸ’…


lowkey reminder: this is an abstract base class. you don't call it, your subclass does. iykyk.

and that's the whole page, bestie πŸ’– this one shipped as part of perl v5.42.0, dated 2025-07-25, straight outta the User Contributed Perl Documentation collection. slay, go forth and mark things deleted (the safe way) πŸŒΈβœ¨πŸ¦‹

πŸ“¦ where this page comes from