25 #ifndef OM_HGUARD_GLASS_DATABASE_H 26 #define OM_HGUARD_GLASS_DATABASE_H 40 #include "../flint_lock.h" 182 const std::string & msg);
229 int flags = Xapian::DB_READONLY_,
230 unsigned int block_size = 0u);
274 const string& term)
const;
276 const string& term)
const;
278 const string& term)
const;
292 const string & start_revision,
320 const char * destdir,
322 const std::vector<Xapian::Database::Internal*>& sources,
323 const std::vector<Xapian::docid> & offset,
361 void check_flush_threshold();
364 void flush_postlist_changes();
433 const string& term)
const;
435 const string& term)
const;
437 const string& term)
const;
446 void add_synonym(
const string & word,
const string & synonym)
const;
447 void remove_synonym(
const string & word,
const string & synonym)
const;
450 void set_metadata(
const string & key,
const string & value);
GlassVersion version_file
The file describing the Glass database.
bool reopen()
Re-open tables to recover from an overwritten condition, or just get most up-to-date version...
Define the XAPIAN_NORETURN macro.
FlintLock lock
Lock object.
virtual void replace_document(Xapian::docid did, const Xapian::Document &document)
Replace a given document in the database.
Xapian::termcount get_unique_terms(Xapian::docid did) const
Virtual methods of Database::Internal.
A RemoteConnection object provides a bidirectional connection to another RemoteConnection object on a...
GlassPositionListTable position_table
Table storing position lists.
void throw_termlist_table_close_exception() const
A position list in a glass database.
void close()
Close all the tables permanently.
TermList * open_synonym_keylist(const string &prefix) const
Virtual methods of Database::Internal.
string get_uuid() const
Virtual methods of Database::Internal.
Xapian::docid get_lastdocid() const
Virtual methods of Database::Internal.
std::string db_dir
Directory to store databases in.
TermList * open_metadata_keylist(const std::string &prefix) const
Virtual methods of Database::Internal.
void create_and_open_tables(int flags, unsigned int blocksize)
Create new tables, and open them.
void apply()
Apply any outstanding changes to the tables.
GlassChanges changes
Replication changesets.
void send_whole_database(RemoteConnection &conn, double end_time)
Send a set of messages which transfer the whole database.
Xapian::doccount get_doccount() const
Virtual methods of Database::Internal.
virtual Xapian::docid add_document(const Xapian::Document &document)
Add a new document to the database.
virtual void commit()
Commit pending modifications to the database.
Class which "inverts the file".
Base class for databases.
uint4 glass_revision_number_t
The revision number of a glass database.
GlassSynonymTable synonym_table
Table storing synonym data.
std::string get_value_lower_bound(Xapian::valueno slot) const
Virtual methods of Database::Internal.
XAPIAN_TOTALLENGTH_TYPE totallength
The total length of all documents in a database.
void write_changesets_to_fd(int fd, const string &start_revision, bool need_whole_db, Xapian::ReplicationInfo *info)
Virtual methods of Database::Internal.
void modifications_failed(glass_revision_number_t new_revision, const std::string &msg)
Called if a modifications fail.
Constants in the Xapian namespace.
The GlassVersion class manages the revision files.
Subclass of GlassTable which holds document data.
static void compact(Xapian::Compactor *compactor, const char *destdir, int fd, const std::vector< Xapian::Database::Internal *> &sources, const std::vector< Xapian::docid > &offset, size_t block_size, Xapian::Compactor::compaction_level compaction, unsigned flags, Xapian::docid last_docid)
double end_time(double timeout)
Return the end time for a timeout in timeout seconds.
virtual void clear_synonyms(const string &term) const
Clear all synonyms for a term.
A document in the database, possibly plus modifications.
Compact a database, or merge and compact several.
Abstract base class for termlists.
Postlists in glass databases.
Xapian::Document::Internal * modify_shortcut_document
A pointer to the last document which was returned by open_document(), or NULL if there is no such val...
Definitions, types, etc for use inside glass.
GlassCursor * get_postlist_cursor() const
Get a postlist table cursor (used by GlassValueList).
virtual void set_metadata(const string &key, const string &value)
Set the metadata associated with a given key.
Subclass of GlassTable which holds termlists.
Xapian::doccount change_count
The number of documents added, deleted, or replaced since the last flush.
Abstract base class for leaf postlists.
glass_revision_number_t get_next_revision_number() const
Get an object holding the next revision number which should be used in the tables.
std::string term
The term name for this postlist (empty for an alldocs postlist).
A position list in a glass database.
friend class GlassWritableDatabase
void get_database_write_lock(int flags, bool creating)
Get a write lock on the database, or throw an Xapian::DatabaseLockError if failure.
GlassDocDataTable docdata_table
Table storing document data.
bool locked() const
Return true if the database is open for writing.
A writable glass database.
virtual void delete_document(Xapian::docid did)
Delete a document in the database.
virtual void read_position_list(GlassPositionList *pos_list, Xapian::docid did, const string &term) const
Virtual methods of Database::Internal.
map< Xapian::valueno, ValueStats > value_stats
virtual void add_synonym(const string &term, const string &synonym) const
Add a synonym for a term.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Xapian::doccount get_spelling_frequency(const string &word) const
Virtual methods of Database::Internal.
A TermList in a glass database.
string get_metadata(const string &key) const
Virtual methods of Database::Internal.
GlassPostListTable postlist_table
Table storing posting lists.
void readahead_for_query(const Xapian::Query &query)
Virtual methods of Database::Internal.
TermList * open_synonym_termlist(const string &term) const
Virtual methods of Database::Internal.
ValueList * open_value_list(Xapian::valueno slot) const
Virtual methods of Database::Internal.
void get_used_docid_range(Xapian::docid &first, Xapian::docid &last) const
Find lowest and highest docids actually in use.
PositionList * open_position_list(Xapian::docid did, const string &term) const
Virtual methods of Database::Internal.
Compact a database, or merge and compact several.
LeafPostList * open_post_list(const string &tname) const
Virtual methods of Database::Internal.
virtual void remove_synonym(const string &term, const string &synonym) const
Remove a synonym for a term.
bool has_positions() const
Virtual methods of Database::Internal.
GlassTermListTable termlist_table
Table storing term lists.
Information about the steps involved in performing a replication.
Xapian::doccount flush_threshold
If change_count reaches this threshold we automatically flush.
virtual void remove_spelling(const string &word, Xapian::termcount freqdec) const
Remove a word from the spelling dictionary.
A postlist in a glass database.
glass_revision_number_t get_revision_number() const
Get an object holding the revision number which the tables are opened at.
bool open_tables(int flags)
Open all tables at most recent revision.
Xapian::termcount get_doclength_lower_bound() const
Virtual methods of Database::Internal.
void cancel()
Cancel any outstanding changes to the tables.
virtual bool has_uncommitted_changes() const
Return true if there are uncommitted changes.
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
Xapian::docid modify_shortcut_docid
The document ID for the last document returned by open_document().
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
void get_freqs(const string &term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const
Virtual methods of Database::Internal.
TermList * open_spelling_termlist(const string &word) const
Virtual methods of Database::Internal.
Abstract base class for value streams.
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
Xapian::termcount get_wdf_upper_bound(const string &term) const
Virtual methods of Database::Internal.
TermList * open_spelling_wordlist() const
Virtual methods of Database::Internal.
bool term_exists(const string &tname) const
Virtual methods of Database::Internal.
void request_document(Xapian::docid) const
Virtual methods of Database::Internal.
void set_revision_number(int flags, glass_revision_number_t new_revision)
Set the revision number in the tables.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
GlassDatabase(const string &db_dir_, int flags=Xapian::DB_READONLY_, unsigned int block_size=0u)
Create and open a glass database.
virtual void add_spelling(const string &word, Xapian::termcount freqinc) const
Add a word to the spelling dictionary.
Xapian::docid did
Document id we're currently at.
GlassCursor * cursor_get() const
Get a cursor for reading from the table.
compaction_level
Compaction level.
unsigned valueno
The number for a value slot in a document.
Xapian::doccount get_value_freq(Xapian::valueno slot) const
Virtual methods of Database::Internal.
virtual void invalidate_doc_object(Xapian::Document::Internal *obj) const
Notify the database that document is no longer valid.
std::string get_value_upper_bound(Xapian::valueno slot) const
Virtual methods of Database::Internal.
Xapian::termcount get_doclength(Xapian::docid did) const
Virtual methods of Database::Internal.
bool database_exists()
Return true if a database exists at the path specified for this database.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Class representing a query.
Inverter class which "inverts the file".
int get_backend_info(string *path) const
Get backend information about this database.
Abstract base class for iterating term positions in a document.
TermList * open_term_list(Xapian::docid did) const
Virtual methods of Database::Internal.
Xapian::totallength get_total_length() const
Virtual methods of Database::Internal.
Synonym data for a glass database.
Xapian::Document::Internal * open_document(Xapian::docid did, bool lazy) const
Virtual methods of Database::Internal.
Spelling correction data for a glass database.
TermList * open_allterms(const string &prefix) const
Virtual methods of Database::Internal.
virtual Xapian::termcount positionlist_count(Xapian::docid did, const string &term) const
Virtual methods of Database::Internal.
GlassValueManager value_manager
Value manager.
GlassSpellingTable spelling_table
Table storing spelling correction data.
A handle representing a document in a Xapian database.
bool readonly
Whether the database is readonly.
Xapian::termcount get_doclength_upper_bound() const
Virtual methods of Database::Internal.
string get_revision_info() const
Virtual methods of Database::Internal.
void get_changeset_revisions(const string &path, glass_revision_number_t *startrev, glass_revision_number_t *endrev) const
Get the revision stored in a changeset.