25 #ifndef OM_HGUARD_CHERT_DATABASE_H 26 #define OM_HGUARD_CHERT_DATABASE_H 39 #include "../flint_lock.h" 200 const std::string & msg);
245 ChertDatabase(
const string &db_dir_,
int action = Xapian::DB_READONLY_,
246 unsigned int block_size = 0u);
299 const string & start_revision,
325 const char * destdir,
326 const std::vector<Xapian::Database::Internal *> & sources,
327 const std::vector<Xapian::docid> & offset,
338 mutable map<string, pair<Xapian::termcount_diff, Xapian::termcount_diff> >
342 mutable map<Xapian::docid, Xapian::termcount>
doclens;
374 void check_flush_threshold();
377 void flush_postlist_changes()
const;
391 void add_freq_delta(
const string & tname,
401 void insert_mod_plist(Xapian::docid did,
402 const string & tname,
416 void update_mod_plist(Xapian::docid did,
417 const string & tname,
431 Xapian::docid add_document_(Xapian::docid did,
const Xapian::Document & document);
486 void add_synonym(
const string & word,
const string & synonym)
const;
487 void remove_synonym(
const string & word,
const string & synonym)
const;
490 void set_metadata(
const string & key,
const string & value);
bool term_exists(const string &tname) const
Virtual methods of Database::Internal.
Subclass of ChertTable which holds termlists.
Xapian::docid get_lastdocid() const
Virtual methods of Database::Internal.
TermList * open_spelling_termlist(const string &word) const
Virtual methods of Database::Internal.
static void compact(Xapian::Compactor *compactor, const char *destdir, 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)
A TermList in a chert database.
Define the XAPIAN_NORETURN macro.
virtual void replace_document(Xapian::docid did, const Xapian::Document &document)
Replace a given document in the database.
A RemoteConnection object provides a bidirectional connection to another RemoteConnection object on a...
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
Records in chert databases.
virtual bool has_uncommitted_changes() const
Return true if there are uncommitted changes.
Xapian::termcount get_wdf_upper_bound(const string &term) const
Virtual methods of Database::Internal.
std::string get_value_upper_bound(Xapian::valueno slot) const
Virtual methods of Database::Internal.
void get_database_write_lock(int flags, bool creating)
Get a write lock on the database, or throw an Xapian::DatabaseLockError if failure.
void readahead_for_query(const Xapian::Query &query)
Virtual methods of Database::Internal.
bool database_exists()
Return true if a database exists at the path specified for this database.
friend class ChertWritableDatabase
TermList * open_synonym_termlist(const string &term) const
Virtual methods of Database::Internal.
Xapian::termcount get_doclength_upper_bound() const
Virtual methods of Database::Internal.
void write_changesets_to_fd(int fd, const string &start_revision, bool need_whole_db, Xapian::ReplicationInfo *info)
Virtual methods of Database::Internal.
map< Xapian::docid, Xapian::termcount > doclens
Document lengths of new and modified documents which haven't been flushed yet.
void get_used_docid_range(Xapian::docid &first, Xapian::docid &last) const
Find lowest and highest docids actually in use.
ChertRecordTable record_table
Table storing records.
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.
void cancel()
Cancel any outstanding changes to the tables.
Base class for databases.
XAPIAN_TOTALLENGTH_TYPE totallength
The total length of all documents in a database.
A writable chert database.
Xapian::doccount get_doccount() const
Virtual methods of Database::Internal.
bool open_tables_consistent()
Open all tables at most recent consistent revision.
Constants in the Xapian namespace.
A record in a chert database.
double end_time(double timeout)
Return the end time for a timeout in timeout seconds.
ChertSpellingTable spelling_table
Table storing spelling correction data.
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.
TermList * open_allterms(const string &prefix) const
Virtual methods of Database::Internal.
chert_revision_number_t get_revision_number() const
Get an object holding the revision number which the tables are opened at.
Abstract base class for termlists.
void set_revision_number(chert_revision_number_t new_revision)
Set the revision number in the tables.
ChertVersion version_file
The file describing the Chert database.
virtual void set_metadata(const string &key, const string &value)
Set the metadata associated with a given key.
ChertPositionListTable position_table
Table storing position lists.
TermList * open_synonym_keylist(const string &prefix) const
Virtual methods of Database::Internal.
int revision()
Report the revision of the library which the program is linked with.
Synonym data for a chert database.
Abstract base class for leaf postlists.
Chert class for database statistics.
void close()
Close all the tables permanently.
std::string term
The term name for this postlist (empty for an alldocs postlist).
ChertPostListTable postlist_table
Table storing posting lists.
PositionList * open_position_list(Xapian::docid did, const string &term) const
Virtual methods of Database::Internal.
ChertSynonymTable synonym_table
Table storing synonym data.
void create_and_open_tables(unsigned int blocksize)
Create new tables, and open them.
Types used by chert backend and the Btree manager.
FlintLock lock
Lock object.
bool has_positions() const
Virtual methods of Database::Internal.
unsigned int chert_revision_number_t
A type used to store a revision number for a table.
Xapian::doccount get_spelling_frequency(const string &word) const
Virtual methods of Database::Internal.
Xapian::docid modify_shortcut_docid
The document ID for the last document returned by open_document().
virtual void delete_document(Xapian::docid did)
Delete a document in the database.
ValueList * open_value_list(Xapian::valueno slot) const
Virtual methods of Database::Internal.
Xapian::termcount get_unique_terms(Xapian::docid did) const
Virtual methods of Database::Internal.
virtual void add_synonym(const string &term, const string &synonym) const
Add a synonym for a term.
The ChertVersion class manages the "iamchert" file.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Xapian::doccount get_value_freq(Xapian::valueno slot) const
Virtual methods of Database::Internal.
int get_backend_info(string *path) const
Get backend information about this database.
void send_whole_database(RemoteConnection &conn, double end_time)
Send a set of messages which transfer the whole database.
bool reopen()
Re-open tables to recover from an overwritten condition, or just get most up-to-date version...
std::string get_value_lower_bound(Xapian::valueno slot) const
Virtual methods of Database::Internal.
std::string db_dir
Directory to store databases in.
ChertValueManager value_manager
Value manager.
map< string, map< Xapian::docid, pair< char, Xapian::termcount > > > mod_plists
Modifications to posting lists.
string get_revision_info() const
Virtual methods of Database::Internal.
TermList * open_spelling_wordlist() const
Virtual methods of Database::Internal.
string get_uuid() const
Virtual methods of Database::Internal.
Xapian::Document::Internal * open_document(Xapian::docid did, bool lazy) const
Virtual methods of Database::Internal.
unsigned int max_changesets
The maximum number of changesets which should be kept in the database.
ChertDatabase(const string &db_dir_, int action=Xapian::DB_READONLY_, unsigned int block_size=0u)
Create and open a chert database.
bool locked() const
Return true if the database is open for writing.
void throw_termlist_table_close_exception() const
Compact a database, or merge and compact several.
ChertCursor * get_postlist_cursor() const
Get a postlist table cursor (used by ChertValueList).
virtual void remove_synonym(const string &term, const string &synonym) const
Remove a synonym for a term.
Information about the steps involved in performing a replication.
virtual void remove_spelling(const string &word, Xapian::termcount freqdec) const
Remove a word from the spelling dictionary.
void open_tables(chert_revision_number_t revision)
Open tables at specified revision number.
ChertCursor * cursor_get() const
Get a cursor for reading from the table.
TermList * open_term_list(Xapian::docid did) const
Virtual methods of Database::Internal.
string get_metadata(const string &key) const
Virtual methods of Database::Internal.
A position list in a chert database.
map< Xapian::valueno, ValueStats > value_stats
Xapian::doccount flush_threshold
If change_count reaches this threshold we automatically flush.
void apply()
Apply any outstanding changes to the tables.
void get_changeset_revisions(const string &path, chert_revision_number_t *startrev, chert_revision_number_t *endrev) const
Get the revision stored in a changeset.
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_BASE_TYPE termcount_diff
A signed difference between two counts of terms.
ChertTermListTable termlist_table
Table storing term lists.
Spelling correction data for a chert database.
Xapian::doccount change_count
The number of documents added, deleted, or replaced since the last flush.
Xapian::termcount get_doclength_lower_bound() const
Virtual methods of Database::Internal.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Xapian::termcount get_doclength(Xapian::docid did) const
Virtual methods of Database::Internal.
virtual void add_spelling(const string &word, Xapian::termcount freqinc) const
Add a word to the spelling dictionary.
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
Postlists in chert databases.
Xapian::docid did
Document id we're currently at.
compaction_level
Compaction level.
unsigned valueno
The number for a value slot in a document.
virtual void invalidate_doc_object(Xapian::Document::Internal *obj) const
Notify the database that document is no longer valid.
map< string, pair< Xapian::termcount_diff, Xapian::termcount_diff > > freq_deltas
Unflushed changes to term frequencies and collection frequencies.
A postlist in a chert database.
bool readonly
Whether the database is readonly.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
ChertDatabaseStats stats
Database statistics.
Class representing a query.
void modifications_failed(chert_revision_number_t old_revision, chert_revision_number_t new_revision, const std::string &msg)
Called if a modifications fail.
Abstract base class for iterating term positions in a document.
void request_document(Xapian::docid) const
Virtual methods of Database::Internal.
Chert class for database statistics.
chert_revision_number_t get_next_revision_number() const
Get an object holding the next revision number which should be used in the tables.
A handle representing a document in a Xapian database.
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...
LeafPostList * open_post_list(const string &tname) const
Virtual methods of Database::Internal.
void get_freqs(const string &term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const
Virtual methods of Database::Internal.
TermList * open_metadata_keylist(const std::string &prefix) const
Virtual methods of Database::Internal.
Xapian::totallength get_total_length() const
Virtual methods of Database::Internal.