Lucy::...Writer(3pm)
π 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
- 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