xapian-core  1.4.31
compactor.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2003-2026 Betts
5  * Copyright (C) 2008 Lemur Consulting Ltd
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22 
23 #ifndef XAPIAN_INCLUDED_COMPACTOR_H
24 #define XAPIAN_INCLUDED_COMPACTOR_H
25 
26 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
27 # error Never use <xapian/compactor.h> directly; include <xapian.h> instead.
28 #endif
29 
30 #include <xapian/constants.h>
31 #include <xapian/deprecated.h>
32 #include <xapian/intrusive_ptr.h>
33 #include <xapian/visibility.h>
34 #include <string>
35 
36 namespace Xapian {
37 
38 class Database;
39 
43  public:
45  class Internal;
46 
48  typedef enum {
50  STANDARD = 0,
52  FULL = 1,
58  FULLER = 2
59  } compaction_level;
60 
61  private:
64 
65  void set_flags_(unsigned flags, unsigned mask = 0);
66 
67  public:
68  Compactor();
69 
70  virtual ~Compactor();
71 
79  XAPIAN_DEPRECATED(void set_block_size(size_t block_size));
80 
93  XAPIAN_DEPRECATED(void set_renumber(bool renumber)) {
94  set_flags_(renumber ? 0 : DBCOMPACT_NO_RENUMBER,
95  ~unsigned(DBCOMPACT_NO_RENUMBER));
96  }
97 
105  XAPIAN_DEPRECATED(void set_multipass(bool multipass)) {
106  set_flags_(multipass ? DBCOMPACT_MULTIPASS : 0,
107  ~unsigned(DBCOMPACT_MULTIPASS));
108  }
109 
120  set_flags_(compaction, ~unsigned(STANDARD|FULL|FULLER));
121  }
122 
133  XAPIAN_DEPRECATED(void set_destdir(const std::string & destdir));
134 
141  XAPIAN_DEPRECATED(void add_source(const std::string & srcdir));
142 
147  XAPIAN_DEPRECATED(void compact());
148 
160  virtual void
161  set_status(const std::string & table, const std::string & status);
162 
185  virtual std::string
186  resolve_duplicate_metadata(const std::string & key,
187  size_t num_tags, const std::string tags[]);
188 };
189 
190 }
191 
192 #endif /* XAPIAN_INCLUDED_COMPACTOR_H */
Compact a database, or merge and compact several.
Definition: compactor.h:42
compaction_level
Compaction level.
Definition: compactor.h:48
void set_compaction_level(compaction_level compaction)
Set the compaction level.
Definition: compactor.h:119
void set_multipass(bool multipass)
Set whether to merge postlists in multiple passes.
Definition: compactor.h:105
void set_renumber(bool renumber)
Set whether to preserve existing document id values.
Definition: compactor.h:93
A smart pointer that uses intrusive reference counting.
Definition: intrusive_ptr.h:82
Constants in the Xapian namespace.
Define XAPIAN_DEPRECATED() and related macros.
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
const int DBCOMPACT_MULTIPASS
If merging more than 3 databases, merge the postlists in multiple passes.
Definition: constants.h:262
const int DBCOMPACT_NO_RENUMBER
Use the same document ids in the output as in the input(s).
Definition: constants.h:256
#define XAPIAN_DEPRECATED(X)
static string srcdir
Definition: stemtest.cc:44
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28
static bool tags