# ***********************************************
# 
# !!!! DO NOT EDIT !!!!
# 
# This file was auto-generated by Build.PL.
# 
# ***********************************************
# 
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

=encoding utf8

=head1 NAME

Lucy::Index::DeletionsWriter - Abstract base class for marking documents as deleted.

=head1 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 );
        ...
    }

=head1 DESCRIPTION

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.

=head1 ABSTRACT METHODS

=head2 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.

=over

=item *

B<field> - The name of an indexed field. (If it is not spec’d as
C<indexed>, an error will occur.)

=item *

B<term> - The term which identifies docs to be marked as deleted.  If
C<field> is associated with an Analyzer, C<term>
will be processed automatically (so don’t pre-process it yourself).

=back

=head2 delete_by_query

    $deletions_writer->delete_by_query($query);

Delete all documents in the index that match C<query>.

=over

=item *

B<query> - A L<Query|Lucy::Search::Query>.

=back

=head2 updated

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

Returns true if there are updates that need to be written.

=head2 seg_del_count

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

Return the number of deletions for a given segment.

=over

=item *

B<seg_name> - The name of the segment.

=back

=head1 INHERITANCE

Lucy::Index::DeletionsWriter isa L<Lucy::Index::DataWriter> isa Clownfish::Obj.

=cut

