22 #ifndef XAPIAN_INCLUDED_DATABASEINTERNAL_H
23 #define XAPIAN_INCLUDED_DATABASEINTERNAL_H
37 #include <string_view>
55 struct ReplicationInfo;
88 :
state(transaction_support) {}
232 bool need_read_pos)
const = 0;
257 std::string_view
term)
const = 0;
335 std::string_view synonym)
const;
342 std::string_view synonym)
const;
354 virtual std::string
get_metadata(std::string_view key)
const;
369 virtual void set_metadata(std::string_view key, std::string_view value);
434 std::string_view start_revision,
451 virtual std::string
get_uuid()
const;
495 virtual bool locked()
const;
516 std::string_view prefix,
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())
Abstract base class for leaf postlists.
Virtual base class for Database internals.
void dtor_called()
Helper to process uncommitted changes when a writable db is destroyed.
virtual termcount get_wdfdocmax(docid did) const =0
Get the max wdf in document.
virtual size_type size() const
virtual void set_metadata(std::string_view key, std::string_view value)
Set the metadata associated with a given key.
virtual bool term_exists(std::string_view term) const =0
virtual void commit()
Commit pending modifications to the database.
virtual TermList * open_term_list(docid did) const =0
virtual void get_used_docid_range(docid &first, docid &last) const
Find lowest and highest docids actually in use.
virtual void replace_document(docid did, const Document &document)
virtual std::string get_value_upper_bound(valueno slot) const =0
Get an upper bound on the values stored in the given value slot.
bool is_read_only() const
Test if this shard is read-only.
transaction_state
Transaction state enum.
@ TRANSACTION_UNIMPLEMENTED
virtual void begin_transaction(bool flushed)
Begin transaction.
virtual void delete_document(docid did)
virtual termcount get_unique_terms_lower_bound() const
Get a lower bound on the unique terms size of a document in this DB.
virtual std::string get_uuid() const
Get a UUID for the database.
virtual void close()=0
Close the database.
virtual std::string get_description() const =0
Return a string describing this object.
virtual TermList * open_spelling_wordlist() const
Return a termlist which returns the words which are spelling correction targets.
virtual std::string get_value_lower_bound(valueno slot) const =0
Get a lower bound on the values stored in the given value slot.
virtual void remove_synonym(std::string_view term, std::string_view synonym) const
Remove a synonym for a term.
virtual Xapian::rev get_revision() const
Get revision number of database (if meaningful).
virtual PositionList * open_position_list(docid did, std::string_view term) const =0
virtual void cancel()
Cancel pending modifications to the database.
virtual docid get_lastdocid() const =0
Return the last used document id of this (sub) database.
virtual TermList * open_spelling_termlist(std::string_view word) const
Create a termlist tree from trigrams of word.
virtual std::string get_metadata(std::string_view key) const
Get the metadata associated with a given key.
virtual void invalidate_doc_object(Document::Internal *obj) const
Notify the database that document is no longer valid.
virtual void write_changesets_to_fd(int fd, std::string_view start_revision, bool need_whole_db, ReplicationInfo *info)
Write a set of changesets to a file descriptor.
virtual termcount get_doclength_upper_bound() const =0
Get an upper bound on the length of a document in this DB.
virtual Document::Internal * open_document(docid did, bool lazy) const =0
Open a handle on a document.
virtual void clear_synonyms(std::string_view term) const
Clear all synonyms for a term.
virtual termcount get_doclength(docid did) const =0
virtual void add_spelling(std::string_view word, termcount freqinc) const
Add a word to the spelling dictionary.
virtual totallength get_total_length() const =0
Return the total length of all documents in this database.
void dtor_called_()
The "action required" helper for the dtor_called() helper.
virtual termcount get_wdf_upper_bound(std::string_view term) const =0
Get an upper bound on the wdf of term term.
virtual PostList * open_post_list(std::string_view term) const =0
Return a PostList suitable for use in a PostingIterator.
virtual int get_backend_info(std::string *path) const =0
Get backend information about this database.
virtual std::string reconstruct_text(Xapian::docid did, size_t length, std::string_view prefix, Xapian::termpos start_pos, Xapian::termpos end_pos) const
virtual TermList * open_allterms(std::string_view prefix) const =0
virtual bool has_positions() const =0
Check whether this database contains any positional information.
transaction_state state
Current transaction state.
Internal(const Internal &)=delete
Don't allow copying.
bool transaction_active() const
Test if a transaction is currently active.
virtual LeafPostList * open_leaf_post_list(std::string_view term, bool need_read_pos) const =0
Create a LeafPostList for use during a match.
virtual void readahead_for_query(const Query &query) const
virtual void add_synonym(std::string_view term, std::string_view synonym) const
Add a synonym for a term.
virtual void request_document(docid did) const
Request a document.
virtual doccount get_value_freq(valueno slot) const =0
Return the frequency of a given value slot.
virtual TermList * open_term_list_direct(docid did) const =0
Like open_term_list() but without MultiTermList wrapper.
virtual TermList * open_synonym_termlist(std::string_view term) const
Open a termlist returning synonyms for a term.
virtual bool locked() const
Return true if the database is open for writing.
Internal(transaction_state transaction_support)
Only constructable as a base class for derived classes.
virtual void end_transaction(bool do_commit)
End transaction.
virtual termcount get_unique_terms(docid did) const =0
Get the number of unique terms in document.
virtual void get_freqs(std::string_view term, doccount *termfreq_ptr, termcount *collfreq_ptr) const =0
Returns frequencies for a term.
virtual TermList * open_metadata_keylist(std::string_view prefix) const
Open a termlist returning each metadata key.
virtual Internal * update_lock(int flags)
Lock a read-only database for writing or unlock a writable database.
virtual TermList * open_synonym_keylist(std::string_view prefix) const
Open a termlist returning each term which has synonyms.
Xapian::doccount size_type
virtual doccount get_doccount() const =0
virtual termcount get_unique_terms_upper_bound() const
Get an upper bound on the unique terms size of a document in this DB.
virtual ~Internal()
We have virtual methods and want to be able to delete derived classes using a pointer to the base cla...
virtual void keep_alive()
Internal & operator=(const Internal &)=delete
Don't allow assignment.
virtual ValueList * open_value_list(valueno slot) const
Open a value stream.
virtual bool reopen()
Reopen the database to the latest available revision.
virtual termcount remove_spelling(std::string_view word, termcount freqdec) const
Remove a word from the spelling dictionary.
virtual doccount get_spelling_frequency(std::string_view word) const
Return the number of times word was added as a spelling.
virtual docid add_document(const Document &document)
virtual termcount get_doclength_lower_bound() const =0
Get a lower bound on the length of a document in this DB.
An indexed database of documents.
Abstract base class for a document.
Class representing a document.
Abstract base class for postlists.
Base class for objects managed by intrusive_ptr.
Abstract base class for iterating term positions in a document.
Class representing a query.
Abstract base class for termlists.
Abstract base class for value streams.
An indexed database of documents.
Xapian::TermIterator::Internal TermList
Xapian::PositionIterator::Internal PositionList
Xapian::ValueIterator::Internal ValueList
Class representing a document.
The Xapian namespace contains public interfaces for the Xapian library.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
XAPIAN_REVISION_TYPE rev
Revision number of a database.
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
unsigned XAPIAN_TERMPOS_BASE_TYPE termpos
A term position within a document or query.
XAPIAN_TOTALLENGTH_TYPE totallength
The total length of all documents in a database.
Class for iterating over term positions.
Class for iterating over a list of document ids.
Information about the steps involved in performing a replication.
Class for iterating over a list of terms.
Class for iterating over document values.