25 #ifndef XAPIAN_INCLUDED_DATABASE_H 26 #define XAPIAN_INCLUDED_DATABASE_H 28 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD 29 # error Never use <xapian/database.h> directly; include <xapian.h> instead. 34 #ifdef XAPIAN_MOVE_SEMANTICS 70 static size_t check_(
const std::string * path_ptr,
int fd,
int opts,
74 void compact_(
const std::string * output_ptr,
83 std::vector<Xapian::Internal::intrusive_ptr<Internal> >
internal;
90 void add_database(
const Database & database);
94 return internal.size();
107 explicit Database(
const std::string &path,
int flags = 0);
120 explicit Database(
int fd,
int flags = 0);
145 void operator=(
const Database &other);
147 #ifdef XAPIAN_MOVE_SEMANTICS 206 virtual void close();
209 virtual std::string get_description()
const;
245 bool has_positions()
const;
265 TermIterator allterms_begin(
const std::string & prefix = std::string())
const;
307 bool term_exists(
const std::string & tname)
const;
423 std::string get_spelling_suggestion(
const std::string &word,
424 unsigned max_edit_distance = 2)
const;
487 std::string get_metadata(
const std::string & key)
const;
528 std::string get_uuid()
const;
564 static size_t check(
const std::string & path,
int opts = 0,
565 std::ostream *out = NULL) {
566 return check_(&path, 0, opts, out);
579 static size_t check(
int fd,
int opts = 0, std::ostream *out = NULL) {
580 return check_(NULL, fd, opts, out);
629 int block_size = 0) {
630 compact_(&output, 0, flags, block_size, NULL);
677 int block_size = 0) {
678 compact_(NULL, fd, flags, block_size, NULL);
728 compact_(&output, 0, flags, block_size, &compactor);
783 compact_(NULL, fd, flags, block_size, &compactor);
876 #ifdef XAPIAN_MOVE_SEMANTICS 1003 void begin_transaction(
bool flushed =
true);
1034 void commit_transaction();
1054 void cancel_transaction();
1128 void delete_document(
const std::string & unique_term);
1197 Xapian::docid replace_document(
const std::string & unique_term,
1207 void add_spelling(
const std::string & word,
1218 void remove_spelling(
const std::string & word,
1227 void add_synonym(
const std::string & term,
1228 const std::string & synonym)
const;
1236 void remove_synonym(
const std::string & term,
1237 const std::string & synonym)
const;
1244 void clear_synonyms(
const std::string & term)
const;
1290 void set_metadata(
const std::string & key,
const std::string & metadata);
1293 std::string get_description()
const;
The Xapian namespace contains public interfaces for the Xapian library.
void compact(int fd, unsigned flags=0, int block_size=0)
Produce a compact version of this database.
PositionIterator positionlist_end(Xapian::docid, const std::string &) const
Corresponding end iterator to positionlist_begin().
static size_t check(const std::string &path, int opts=0, std::ostream *out=NULL)
Check the integrity of a database or database table.
XAPIAN_REVISION_TYPE rev
Revision number of a database.
This class is used to access a database, or a group of databases.
static size_t check(int fd, int opts=0, std::ostream *out=NULL)
Check the integrity of a single file database.
Base class for databases.
XAPIAN_TOTALLENGTH_TYPE totallength
The total length of all documents in a database.
TermIterator allterms_end(const std::string &=std::string()) const
Corresponding end iterator to allterms_begin(prefix).
Compiler attribute macros.
Define XAPIAN_DEPRECATED() and related macros.
Class for iterating over document values.
Xapian::TermIterator synonyms_end(const std::string &) const
Corresponding end iterator to synonyms_begin(term).
#define XAPIAN_DEPRECATED(X)
Class for iterating over term positions.
#define XAPIAN_VISIBILITY_DEFAULT
Class for iterating over a list of terms.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Class for iterating over a list of terms.
void compact(int fd, unsigned flags, int block_size, Xapian::Compactor &compactor)
Produce a compact version of this database.
ValueIterator valuestream_end(Xapian::valueno) const
Return end iterator corresponding to valuestream_begin().
This class provides read/write access to a database.
Define XAPIAN_VISIBILITY_* macros.
double doclength
A normalised document length.
Compact a database, or merge and compact several.
void compact(const std::string &output, unsigned flags, int block_size, Xapian::Compactor &compactor)
Produce a compact version of this database.
Xapian::TermIterator synonym_keys_end(const std::string &=std::string()) const
Corresponding end iterator to synonym_keys_begin(prefix).
Class for iterating over document values.
Class for iterating over term positions.
TermIterator termlist_end(Xapian::docid) const
Corresponding end iterator to termlist_begin().
void compact(const std::string &output, unsigned flags=0, int block_size=0)
Produce a compact version of this database.
void add_database(const Database &database)
Add an existing database (or group of databases) to those accessed by this object.
size_t size() const
Return number of shards in this Database object.
double get_average_length() const
New name for get_avlength().
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
void add_database(const WritableDatabase &other)
Add shards from another WritableDatabase.
void flush()
Pre-1.1.0 name for commit().
unsigned valueno
The number for a value slot in a document.
void operator=(const Database &other)
Assignment is allowed.
Class for iterating over a list of document ids.
Xapian::TermIterator spellings_end() const
Corresponding end iterator to spellings_begin().
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
PostingIterator postlist_end(const std::string &) const
Corresponding end iterator to postlist_begin().
Class for iterating over a list of terms.
A handle representing a document in a Xapian database.
Xapian::TermIterator metadata_keys_end(const std::string &=std::string()) const
Corresponding end iterator to metadata_keys_begin().