xapian-core  2.0.0
Public Types | Public Member Functions | List of all members
Xapian::Compactor Class Reference

Compact a database, or merge and compact several. More...

#include <compactor.h>

+ Inheritance diagram for Xapian::Compactor:

Public Types

enum  compaction_level { STANDARD = 0 , FULL = 1 , FULLER = 2 }
 Compaction level. More...
 

Public Member Functions

 Compactor ()
 
virtual ~Compactor ()
 
virtual void set_status (const std::string &table, const std::string &status)
 Update progress. More...
 
virtual std::string resolve_duplicate_metadata (const std::string &key, size_t num_tags, const std::string tags[])
 Resolve multiple user metadata entries with the same key. More...
 

Detailed Description

Compact a database, or merge and compact several.

Definition at line 39 of file compactor.h.

Member Enumeration Documentation

◆ compaction_level

Compaction level.

Enumerator
STANDARD 

Don't split items unnecessarily.

FULL 

Split items whenever it saves space (the default).

FULLER 

Allow oversize items to save more space (not recommended if you ever plan to update the compacted database).

Since
1.4.31 Has the same effect as FULL.

Definition at line 42 of file compactor.h.

Constructor & Destructor Documentation

◆ Compactor()

Xapian::Compactor::Compactor ( )
inline

Definition at line 55 of file compactor.h.

◆ ~Compactor()

Xapian::Compactor::~Compactor ( )
virtual

Definition at line 84 of file compactor.cc.

Member Function Documentation

◆ resolve_duplicate_metadata()

string Xapian::Compactor::resolve_duplicate_metadata ( const std::string &  key,
size_t  num_tags,
const std::string  tags[] 
)
virtual

Resolve multiple user metadata entries with the same key.

When merging, if the same user metadata key is set in more than one input, then this method is called to allow this to be resolving in an appropriate way.

The default implementation just returns tags[0].

For multipass this will currently get called multiple times for the same key if there are duplicates to resolve in each pass, but this may change in the future.

Since 1.4.6, an implementation of this method can return an empty string to indicate that the appropriate result is to not set a value for this user metadata key in the output database. In older versions, you should not return an empty string.

Parameters
keyThe metadata key with duplicate entries.
num_tagsHow many tags there are.
tagsAn array of num_tags strings containing the tags to merge.

Reimplemented in MyCompactor.

Definition at line 94 of file compactor.cc.

References tags.

Referenced by GlassCompact::merge_postlists(), and HoneyCompact::merge_postlists().

◆ set_status()

void Xapian::Compactor::set_status ( const std::string &  table,
const std::string &  status 
)
virtual

Update progress.

Subclass this method if you want to get progress updates during compaction. This is called for each table first with empty status, And then one or more times with non-empty status.

The default implementation does nothing.

Parameters
tableThe table currently being compacted.
statusA status message.

Reimplemented in MyCompactor.

Definition at line 87 of file compactor.cc.

Referenced by GlassDatabase::compact(), and HoneyDatabase::compact().


The documentation for this class was generated from the following files: