codec.base
module¶
This module contains base classes/interfaces for “codec” objects.
Classes¶
- class whoosh.codec.base.Segment(indexname)[source]¶
Do not instantiate this object directly. It is used by the Index object to hold information about a segment. A list of objects of this class are pickled as part of the TOC file.
The TOC file stores a minimal amount of information – mostly a list of Segment objects. Segments are the real reverse indexes. Having multiple segments allows quick incremental indexing: just create a new segment for the new documents, and have the index overlay the new segment over previous ones for purposes of reading/search. “Optimizing” the index combines the contents of existing segments into one (removing any deleted documents along the way).
- create_file(storage, ext, **kwargs)[source]¶
Convenience method to create a new file in the given storage named with this segment’s ID and the given extension. Any keyword arguments are passed to the storage’s create_file method.
- abstract delete_document(docnum, delete=True)[source]¶
Deletes the given document number. The document is not actually removed from the index until it is optimized.
- Parameters:
docnum – The document number to delete.
delete – If False, this undeletes a deleted document.