Lucy::Index::DeletionsWriter - Abstract base class for marking documents as deleted.
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 ); ... }
Subclasses of DeletionsWriter provide a low-level mechanism for declaring a document deleted from an index.
Because files in an index are never modified, and because it is not practical to delete entire segments, a DeletionsWriter does not actually remove documents from the index. Instead, it communicates to a search-time companion DeletionsReader which documents are deleted in such a way that it can create a Matcher iterator.
Documents are truly deleted only when the segments which contain them are merged into new ones.
$deletions_writer->delete_by_term( field => $field # required term => $term # required );
Delete all documents in the index that index the supplied term.
indexed
,
an error will occur.)field
is associated with an Analyzer,
term
will be processed automatically (so don’t pre-process it yourself).$deletions_writer->delete_by_query($query);
Delete all documents in the index that match query
.
my $bool = $deletions_writer->updated();
Returns true if there are updates that need to be written.
my $int = $deletions_writer->seg_del_count($seg_name);
Return the number of deletions for a given segment.
Lucy::Index::DeletionsWriter isa Lucy::Index::DataWriter isa Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.