parcel | Lucy |
class variable | LUCY_DELETIONSWRITER |
struct symbol | lucy_DeletionsWriter |
class nickname | lucy_DelWriter |
header file | Lucy/Index/DeletionsWriter.h |
Lucy::Index::DeletionsWriter – Abstract base class for marking documents as deleted.
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.
void
lucy_DelWriter_Delete_By_Term(
lucy_DeletionsWriter *self,
cfish_String *field,
cfish_Obj *term
);
Delete all documents in the index that index the supplied term.
The name of an indexed field. (If it is not spec’d as
indexed
, an error will occur.)
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).
void
lucy_DelWriter_Delete_By_Query(
lucy_DeletionsWriter *self,
lucy_Query *query
);
Delete all documents in the index that match query
.
A Query.
bool
lucy_DelWriter_Updated(
lucy_DeletionsWriter *self
);
Returns true if there are updates that need to be written.
int32_t
lucy_DelWriter_Seg_Del_Count(
lucy_DeletionsWriter *self,
cfish_String *seg_name
);
Return the number of deletions for a given segment.
The name of the segment.
void
lucy_DelWriter_Add_Segment(
lucy_DeletionsWriter *self,
lucy_SegReader *reader,
lucy_I32Array *doc_map
);
Add content from an existing segment into the one currently being written.
The SegReader containing content to add.
An array of integers mapping old document ids to new. Deleted documents are mapped to 0, indicating that they should be skipped.
void
lucy_DelWriter_Delete_Segment(
lucy_DeletionsWriter *self,
lucy_SegReader *reader
);
Remove a segment’s data. The default implementation is a no-op, as all files within the segment directory will be automatically deleted. Subclasses which manage their own files outside of the segment system should override this method and use it as a trigger for cleaning up obsolete data.
The SegReader containing content to merge, which must represent a segment which is part of the the current snapshot.
void
lucy_DelWriter_Merge_Segment(
lucy_DeletionsWriter *self,
lucy_SegReader *reader,
lucy_I32Array *doc_map
);
Move content from an existing segment into the one currently being written.
The default implementation calls Add_Segment() then Delete_Segment().
The SegReader containing content to merge, which must represent a segment which is part of the the current snapshot.
An array of integers mapping old document ids to new. Deleted documents are mapped to 0, indicating that they should be skipped.
void
lucy_DelWriter_Finish(
lucy_DeletionsWriter *self
);
Complete the segment: close all streams, store metadata, etc.
cfish_Hash* // incremented
lucy_DelWriter_Metadata(
lucy_DeletionsWriter *self
);
Arbitrary metadata to be serialized and stored by the Segment. The default implementation supplies a hash with a single key-value pair for “format”.
int32_t
lucy_DelWriter_Format(
lucy_DeletionsWriter *self
);
Every writer must specify a file format revision number, which should increment each time the format changes. Responsibility for revision checking is left to the companion DataReader.
lucy_Snapshot*
lucy_DelWriter_Get_Snapshot(
lucy_DeletionsWriter *self
);
Accessor for “snapshot” member var.
lucy_Segment*
lucy_DelWriter_Get_Segment(
lucy_DeletionsWriter *self
);
Accessor for “segment” member var.
lucy_PolyReader*
lucy_DelWriter_Get_PolyReader(
lucy_DeletionsWriter *self
);
Accessor for “polyreader” member var.
lucy_Schema*
lucy_DelWriter_Get_Schema(
lucy_DeletionsWriter *self
);
Accessor for “schema” member var.
lucy_Folder*
lucy_DelWriter_Get_Folder(
lucy_DeletionsWriter *self
);
Accessor for “folder” member var.
Lucy::Index::DeletionsWriter is a Lucy::Index::DataWriter is a 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.