xapian-core  1.4.26
compactor.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010,2011,2013,2014,2015,2018 Olly 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,
55  FULLER = 2
57 
58  private:
61 
62  void set_flags_(unsigned flags, unsigned mask = 0);
63 
64  public:
65  Compactor();
66 
67  virtual ~Compactor();
68 
76  XAPIAN_DEPRECATED(void set_block_size(size_t block_size));
77 
90  XAPIAN_DEPRECATED(void set_renumber(bool renumber)) {
91  set_flags_(renumber ? 0 : DBCOMPACT_NO_RENUMBER,
92  ~unsigned(DBCOMPACT_NO_RENUMBER));
93  }
94 
102  XAPIAN_DEPRECATED(void set_multipass(bool multipass)) {
103  set_flags_(multipass ? DBCOMPACT_MULTIPASS : 0,
104  ~unsigned(DBCOMPACT_MULTIPASS));
105  }
106 
117  set_flags_(compaction, ~unsigned(STANDARD|FULL|FULLER));
118  }
119 
130  XAPIAN_DEPRECATED(void set_destdir(const std::string & destdir));
131 
138  XAPIAN_DEPRECATED(void add_source(const std::string & srcdir));
139 
144  XAPIAN_DEPRECATED(void compact());
145 
157  virtual void
158  set_status(const std::string & table, const std::string & status);
159 
182  virtual std::string
183  resolve_duplicate_metadata(const std::string & key,
184  size_t num_tags, const std::string tags[]);
185 };
186 
187 }
188 
189 #endif /* XAPIAN_INCLUDED_COMPACTOR_H */
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
void set_multipass(bool multipass)
Set whether to merge postlists in multiple passes.
Definition: compactor.h:102
Constants in the Xapian namespace.
Define XAPIAN_DEPRECATED() and related macros.
static bool tags
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)
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28
Define XAPIAN_VISIBILITY_* macros.
static string srcdir
Definition: stemtest.cc:43
Compact a database, or merge and compact several.
Definition: compactor.h:42
void set_compaction_level(compaction_level compaction)
Set the compaction level.
Definition: compactor.h:116
compaction_level
Compaction level.
Definition: compactor.h:48
void set_renumber(bool renumber)
Set whether to preserve existing document id values.
Definition: compactor.h:90
const int DBCOMPACT_MULTIPASS
If merging more than 3 databases, merge the postlists in multiple passes.
Definition: constants.h:262
A smart pointer that uses intrusive reference counting.
Definition: intrusive_ptr.h:81