xapian-core  1.4.26
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Xapian::Database::Internal Class Referenceabstract

Base class for databases. More...

#include <database.h>

+ Inheritance diagram for Xapian::Database::Internal:
+ Collaboration diagram for Xapian::Database::Internal:

Public Member Functions

virtual ~Internal ()
 Destroy the database. More...
 
virtual void keep_alive ()
 Send a keep-alive signal to a remote database, to stop it from timing out. More...
 
virtual void readahead_for_query (const Xapian::Query &query)
 
virtual Xapian::doccount get_doccount () const =0
 Return the number of docs in this (sub) database. More...
 
virtual Xapian::docid get_lastdocid () const =0
 Return the last used document id of this (sub) database. More...
 
virtual Xapian::totallength get_total_length () const =0
 Return the total length of all documents in this database. More...
 
virtual Xapian::termcount get_doclength (Xapian::docid did) const =0
 Get the length of a given document. More...
 
virtual Xapian::termcount get_unique_terms (Xapian::docid did) const =0
 Get the number of unique term in document. More...
 
virtual void get_freqs (const string &term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const =0
 Returns frequencies for a term. More...
 
virtual Xapian::doccount get_value_freq (Xapian::valueno slot) const =0
 Return the frequency of a given value slot. More...
 
virtual std::string get_value_lower_bound (Xapian::valueno slot) const =0
 Get a lower bound on the values stored in the given value slot. More...
 
virtual std::string get_value_upper_bound (Xapian::valueno slot) const =0
 Get an upper bound on the values stored in the given value slot. More...
 
virtual Xapian::termcount get_doclength_lower_bound () const
 Get a lower bound on the length of a document in this DB. More...
 
virtual Xapian::termcount get_doclength_upper_bound () const
 Get an upper bound on the length of a document in this DB. More...
 
virtual Xapian::termcount get_wdf_upper_bound (const std::string &term) const
 Get an upper bound on the wdf of term term. More...
 
virtual bool term_exists (const string &tname) const =0
 Check whether a given term is in the database. More...
 
virtual bool has_positions () const =0
 Check whether this database contains any positional information. More...
 
virtual LeafPostListopen_post_list (const string &tname) const =0
 Open a posting list. More...
 
virtual ValueListopen_value_list (Xapian::valueno slot) const
 Open a value stream. More...
 
virtual TermListopen_term_list (Xapian::docid did) const =0
 Open a term list. More...
 
virtual TermListopen_allterms (const string &prefix) const =0
 Open an allterms list. More...
 
virtual PositionListopen_position_list (Xapian::docid did, const string &tname) const =0
 Open a position list for the given term in the given document. More...
 
virtual Xapian::Document::Internalopen_document (Xapian::docid did, bool lazy) const =0
 Open a document. More...
 
virtual TermListopen_spelling_termlist (const string &word) const
 Create a termlist tree from trigrams of word. More...
 
virtual TermListopen_spelling_wordlist () const
 Return a termlist which returns the words which are spelling correction targets. More...
 
virtual Xapian::doccount get_spelling_frequency (const string &word) const
 Return the number of times word was added as a spelling. More...
 
virtual void add_spelling (const string &word, Xapian::termcount freqinc) const
 Add a word to the spelling dictionary. More...
 
virtual void remove_spelling (const string &word, Xapian::termcount freqdec) const
 Remove a word from the spelling dictionary. More...
 
virtual TermListopen_synonym_termlist (const string &term) const
 Open a termlist returning synonyms for a term. More...
 
virtual TermListopen_synonym_keylist (const string &prefix) const
 Open a termlist returning each term which has synonyms. More...
 
virtual void add_synonym (const string &term, const string &synonym) const
 Add a synonym for a term. More...
 
virtual void remove_synonym (const string &term, const string &synonym) const
 Remove a synonym for a term. More...
 
virtual void clear_synonyms (const string &term) const
 Clear all synonyms for a term. More...
 
virtual string get_metadata (const string &key) const
 Get the metadata associated with a given key. More...
 
virtual TermListopen_metadata_keylist (const std::string &prefix) const
 Open a termlist returning each metadata key. More...
 
virtual void set_metadata (const string &key, const string &value)
 Set the metadata associated with a given key. More...
 
virtual bool reopen ()
 Reopen the database to the latest available revision. More...
 
virtual void close ()=0
 Close the database. More...
 
virtual void commit ()
 Commit pending modifications to the database. More...
 
virtual void cancel ()
 Cancel pending modifications to the database. More...
 
void begin_transaction (bool flushed)
 Begin a transaction. More...
 
void commit_transaction ()
 Commit a transaction. More...
 
void cancel_transaction ()
 Cancel a transaction. More...
 
virtual Xapian::docid add_document (const Xapian::Document &document)
 Add a new document to the database. More...
 
virtual void delete_document (Xapian::docid did)
 Delete a document in the database. More...
 
virtual void delete_document (const string &unique_term)
 Delete any documents indexed by a term from the database. More...
 
virtual void replace_document (Xapian::docid did, const Xapian::Document &document)
 Replace a given document in the database. More...
 
virtual Xapian::docid replace_document (const string &unique_term, const Xapian::Document &document)
 Replace any documents matching a term. More...
 
virtual void write_changesets_to_fd (int fd, const std::string &start_revision, bool need_whole_db, Xapian::ReplicationInfo *info)
 Write a set of changesets to a file descriptor. More...
 
virtual string get_revision_info () const
 Get a string describing the current revision of the database. More...
 
virtual string get_uuid () const
 Get a UUID for the database. More...
 
virtual void invalidate_doc_object (Xapian::Document::Internal *obj) const
 Notify the database that document is no longer valid. More...
 
virtual int get_backend_info (string *path) const =0
 Get backend information about this database. More...
 
virtual void get_used_docid_range (Xapian::docid &first, Xapian::docid &last) const
 Find lowest and highest docids actually in use. More...
 
virtual bool locked () const
 Return true if the database is open for writing. More...
 
virtual void request_document (Xapian::docid) const
 Request and later collect a document from the database. More...
 
virtual Xapian::Document::Internalcollect_document (Xapian::docid did) const
 Request and later collect a document from the database. More...
 
- Public Member Functions inherited from Xapian::Internal::intrusive_base
 intrusive_base ()
 Construct with no references. More...
 

Protected Types

enum  { TRANSACTION_UNIMPLEMENTED = -1, TRANSACTION_NONE = 0, TRANSACTION_UNFLUSHED = 1, TRANSACTION_FLUSHED = 2 }
 Transaction state. More...
 

Protected Member Functions

bool transaction_active () const
 
 Internal ()
 Create a database - called only by derived classes. More...
 
void dtor_called ()
 Internal method to perform cleanup when a writable database is destroyed with uncommitted changes. More...
 

Protected Attributes

enum Xapian::Database::Internal:: { ... }  transaction_state
 Transaction state. More...
 

Private Member Functions

 Internal (const Internal &)
 Copies are not allowed. More...
 
void operator= (const Internal &)
 Assignment is not allowed. More...
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::intrusive_base
unsigned _refs
 Reference count. More...
 

Detailed Description

Base class for databases.

Definition at line 57 of file database.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Transaction state.

Enumerator
TRANSACTION_UNIMPLEMENTED 
TRANSACTION_NONE 
TRANSACTION_UNFLUSHED 
TRANSACTION_FLUSHED 

Definition at line 67 of file database.h.

Constructor & Destructor Documentation

◆ Internal() [1/2]

Xapian::Database::Internal::Internal ( const Internal )
private

Copies are not allowed.

◆ Internal() [2/2]

Xapian::Database::Internal::Internal ( )
inlineprotected

◆ ~Internal()

Xapian::Database::Internal::~Internal ( )
virtual

Destroy the database.

This method should not be called until all objects using the database have been cleaned up.

If any transactions are in progress, they should be finished by cancel_transaction() or commit_transaction() - if this is not done, the destructor will attempt to clean things up by cancelling the transaction, but any errors produced by these operations will not be reported.

Definition at line 42 of file database.cc.

Referenced by Internal().

Member Function Documentation

◆ add_document()

Xapian::docid Xapian::Database::Internal::add_document ( const Xapian::Document document)
virtual

Add a new document to the database.

See WritableDatabase::add_document() for more information.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, and RemoteDatabase.

Definition at line 161 of file database.cc.

References Assert.

Referenced by Internal().

◆ add_spelling()

void Xapian::Database::Internal::add_spelling ( const string &  word,
Xapian::termcount  freqinc 
) const
virtual

Add a word to the spelling dictionary.

If the word is already present, its frequency is increased.

Parameters
wordThe word to add.
freqincHow much to increase its frequency by.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, and RemoteDatabase.

Definition at line 244 of file database.cc.

Referenced by Internal().

◆ add_synonym()

void Xapian::Database::Internal::add_synonym ( const string &  term,
const string &  synonym 
) const
virtual

Add a synonym for a term.

If synonym is already a synonym for term, then no action is taken.

Reimplemented in ChertWritableDatabase, and GlassWritableDatabase.

Definition at line 274 of file database.cc.

Referenced by Internal().

◆ begin_transaction()

void Xapian::Database::Internal::begin_transaction ( bool  flushed)

Begin a transaction.

See WritableDatabase::begin_transaction() for more information.

Definition at line 116 of file database.cc.

Referenced by Internal().

◆ cancel()

void Xapian::Database::Internal::cancel ( )
virtual

Cancel pending modifications to the database.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, RemoteDatabase, ChertDatabase, and GlassDatabase.

Definition at line 109 of file database.cc.

References Assert.

Referenced by Internal().

◆ cancel_transaction()

void Xapian::Database::Internal::cancel_transaction ( )

Cancel a transaction.

See WritableDatabase::cancel_transaction() for more information.

Definition at line 149 of file database.cc.

Referenced by RemoteDatabase::do_close(), and Internal().

◆ clear_synonyms()

void Xapian::Database::Internal::clear_synonyms ( const string &  term) const
virtual

Clear all synonyms for a term.

If term has no synonyms, no action is taken.

Reimplemented in ChertWritableDatabase, and GlassWritableDatabase.

Definition at line 286 of file database.cc.

Referenced by Internal().

◆ close()

virtual void Xapian::Database::Internal::close ( )
pure virtual

◆ collect_document()

Xapian::Document::Internal * Xapian::Database::Internal::collect_document ( Xapian::docid  did) const
virtual

Request and later collect a document from the database.

Multiple documents can be requested with request_document(), and then collected with collect_document(). Allows the backend to optimise (e.g. the remote backend can start requests for all the documents so they fetch in parallel).

If a backend doesn't support this, request_document() can be a no-op and collect_document() the same as open_document().

Definition at line 326 of file database.cc.

Referenced by Internal().

◆ commit()

void Xapian::Database::Internal::commit ( )
virtual

Commit pending modifications to the database.

See WritableDatabase::commit() for more information.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, and RemoteDatabase.

Definition at line 102 of file database.cc.

References Assert.

Referenced by Internal().

◆ commit_transaction()

void Xapian::Database::Internal::commit_transaction ( )

Commit a transaction.

See WritableDatabase::commit_transaction() for more information.

Definition at line 134 of file database.cc.

Referenced by Internal().

◆ delete_document() [1/2]

void Xapian::Database::Internal::delete_document ( Xapian::docid  did)
virtual

Delete a document in the database.

See WritableDatabase::delete_document() for more information.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, and RemoteDatabase.

Definition at line 169 of file database.cc.

References Assert.

Referenced by Internal().

◆ delete_document() [2/2]

void Xapian::Database::Internal::delete_document ( const string &  unique_term)
virtual

Delete any documents indexed by a term from the database.

See WritableDatabase::delete_document() for more information.

Reimplemented in RemoteDatabase.

Definition at line 176 of file database.cc.

References Xapian::PostingIterator::Internal::at_end(), Xapian::PostingIterator::Internal::get_docid(), and Xapian::PostingIterator::Internal::next().

◆ dtor_called()

void Xapian::Database::Internal::dtor_called ( )
protected

Internal method to perform cleanup when a writable database is destroyed with uncommitted changes.

A derived class' destructor should call this method before destroying the database to ensure that no sessions or transactions are in progress at destruction time.

Note that it is not safe to throw exceptions from destructors, so this method will catch and discard any exceptions.

Definition at line 87 of file database.cc.

Referenced by Internal(), ChertWritableDatabase::~ChertWritableDatabase(), GlassWritableDatabase::~GlassWritableDatabase(), and InMemoryDatabase::~InMemoryDatabase().

◆ get_backend_info()

virtual int Xapian::Database::Internal::get_backend_info ( string *  path) const
pure virtual

Get backend information about this database.

Parameters
pathIf non-NULL, and set the pointed to string to the file path of this database (or if to some string describing the database in a backend-specified format if "path" isn't a concept which make sense).
Returns
A constant indicating the backend type.

Implemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal(), and MultiMatch::MultiMatch().

◆ get_doccount()

virtual Xapian::doccount Xapian::Database::Internal::get_doccount ( ) const
pure virtual

Return the number of docs in this (sub) database.

Implemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Xapian::Weight::Internal::accumulate_stats(), Xapian::Database::compact_(), and Internal().

◆ get_doclength()

virtual Xapian::termcount Xapian::Database::Internal::get_doclength ( Xapian::docid  did) const
pure virtual

Get the length of a given document.

Document length, for the purposes of Xapian, is defined to be the number of instances of terms within a document. Expressed differently, the sum of the within document frequencies over all the terms in the document.

Parameters
didThe document id of the document whose length is being requested.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal().

◆ get_doclength_lower_bound()

Xapian::termcount Xapian::Database::Internal::get_doclength_lower_bound ( ) const
virtual

Get a lower bound on the length of a document in this DB.

This bound does not include any zero-length documents.

Reimplemented in ChertDatabase, RemoteDatabase, and GlassDatabase.

Definition at line 59 of file database.cc.

Referenced by Internal().

◆ get_doclength_upper_bound()

Xapian::termcount Xapian::Database::Internal::get_doclength_upper_bound ( ) const
virtual

Get an upper bound on the length of a document in this DB.

Reimplemented in ChertDatabase, RemoteDatabase, and GlassDatabase.

Definition at line 67 of file database.cc.

Referenced by Internal().

◆ get_freqs()

virtual void Xapian::Database::Internal::get_freqs ( const string &  term,
Xapian::doccount termfreq_ptr,
Xapian::termcount collfreq_ptr 
) const
pure virtual

Returns frequencies for a term.

Parameters
termThe term to get frequencies for
termfreq_ptrPoint to return number of docs indexed by term (or NULL not to return)
collfreq_ptrPoint to return number of occurrences of term in the database (or NULL not to return)

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Xapian::Weight::Internal::accumulate_stats(), and Internal().

◆ get_lastdocid()

virtual Xapian::docid Xapian::Database::Internal::get_lastdocid ( ) const
pure virtual

Return the last used document id of this (sub) database.

Implemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Xapian::Database::compact_(), and Internal().

◆ get_metadata()

string Xapian::Database::Internal::get_metadata ( const string &  key) const
virtual

Get the metadata associated with a given key.

See Database::get_metadata() for more information.

Reimplemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Definition at line 292 of file database.cc.

Referenced by Internal().

◆ get_revision_info()

string Xapian::Database::Internal::get_revision_info ( ) const
virtual

Get a string describing the current revision of the database.

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 341 of file database.cc.

Referenced by Internal().

◆ get_spelling_frequency()

Xapian::doccount Xapian::Database::Internal::get_spelling_frequency ( const string &  word) const
virtual

Return the number of times word was added as a spelling.

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 235 of file database.cc.

Referenced by Internal().

◆ get_total_length()

virtual Xapian::totallength Xapian::Database::Internal::get_total_length ( ) const
pure virtual

Return the total length of all documents in this database.

Implemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Xapian::Weight::Internal::accumulate_stats(), and Internal().

◆ get_unique_terms()

virtual Xapian::termcount Xapian::Database::Internal::get_unique_terms ( Xapian::docid  did) const
pure virtual

Get the number of unique term in document.

Parameters
didThe document id of the document whose number of terms is being requested.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal().

◆ get_used_docid_range()

void Xapian::Database::Internal::get_used_docid_range ( Xapian::docid first,
Xapian::docid last 
) const
virtual

Find lowest and highest docids actually in use.

Only used by compaction, so only needs to be implemented by backends which support compaction.

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 359 of file database.cc.

Referenced by Xapian::Database::compact_(), and Internal().

◆ get_uuid()

string Xapian::Database::Internal::get_uuid ( ) const
virtual

Get a UUID for the database.

The UUID will persist for the lifetime of the database.

Replicas (eg, made with the replication protocol, or by copying all the database files) will have the same UUID. However, copies (made with copydatabase, or xapian-compact) will have different UUIDs.

If the backend does not support UUIDs the empty string is returned.

Reimplemented in ChertDatabase, GlassDatabase, and RemoteDatabase.

Definition at line 347 of file database.cc.

Referenced by Internal().

◆ get_value_freq()

virtual Xapian::doccount Xapian::Database::Internal::get_value_freq ( Xapian::valueno  slot) const
pure virtual

Return the frequency of a given value slot.

This is the number of documents which have a (non-empty) value stored in the slot.

Parameters
slotThe value slot to examine.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, RemoteDatabase, and GlassDatabase.

Referenced by Internal(), Xapian::Internal::QueryValueRange::postlist(), Xapian::Internal::QueryValueLE::postlist(), and Xapian::Internal::QueryValueGE::postlist().

◆ get_value_lower_bound()

virtual std::string Xapian::Database::Internal::get_value_lower_bound ( Xapian::valueno  slot) const
pure virtual

Get a lower bound on the values stored in the given value slot.

If there are no values stored in the given value slot, this will return an empty string.

Parameters
slotThe value slot to examine.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, RemoteDatabase, and GlassDatabase.

Referenced by Internal(), Xapian::Internal::QueryValueRange::postlist(), Xapian::Internal::QueryValueLE::postlist(), and Xapian::Internal::QueryValueGE::postlist().

◆ get_value_upper_bound()

virtual std::string Xapian::Database::Internal::get_value_upper_bound ( Xapian::valueno  slot) const
pure virtual

Get an upper bound on the values stored in the given value slot.

If there are no values stored in the given value slot, this will return an empty string.

Parameters
slotThe value slot to examine.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, RemoteDatabase, and GlassDatabase.

Referenced by Internal(), Xapian::Internal::QueryValueRange::postlist(), Xapian::Internal::QueryValueLE::postlist(), and Xapian::Internal::QueryValueGE::postlist().

◆ get_wdf_upper_bound()

Xapian::termcount Xapian::Database::Internal::get_wdf_upper_bound ( const std::string &  term) const
virtual

Get an upper bound on the wdf of term term.

Reimplemented in ChertDatabase, RemoteDatabase, and GlassDatabase.

Definition at line 75 of file database.cc.

Referenced by Internal().

◆ has_positions()

virtual bool Xapian::Database::Internal::has_positions ( ) const
pure virtual

Check whether this database contains any positional information.

Implemented in GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal(), and Xapian::Internal::QueryWindowed::postlist_windowed().

◆ invalidate_doc_object()

void Xapian::Database::Internal::invalidate_doc_object ( Xapian::Document::Internal obj) const
virtual

Notify the database that document is no longer valid.

This is used to invalidate references to a document kept by a database for doing lazy updates. If we moved to using a weak_ptr instead we wouldn't need a special method for this, but it would involve a fair bit of reorganising of other parts of the code.

Reimplemented in ChertWritableDatabase, and GlassWritableDatabase.

Definition at line 353 of file database.cc.

Referenced by Internal().

◆ keep_alive()

void Xapian::Database::Internal::keep_alive ( )
virtual

Send a keep-alive signal to a remote database, to stop it from timing out.

Reimplemented in RemoteDatabase.

Definition at line 47 of file database.cc.

Referenced by Internal().

◆ locked()

bool Xapian::Database::Internal::locked ( ) const
virtual

Return true if the database is open for writing.

If this is a WritableDatabase, always returns true.

For a Database, test if there's a writer holding the lock (or if we can't test for a lock without taking it on the current platform, throw Xapian::UnimplementedError).

Reimplemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Definition at line 366 of file database.cc.

Referenced by Internal().

◆ open_allterms()

virtual TermList* Xapian::Database::Internal::open_allterms ( const string &  prefix) const
pure virtual

Open an allterms list.

This is a list of all the terms in the database

Parameters
prefixThe prefix to restrict the terms to.
Returns
A pointer to the newly created allterms list. This object must be deleted by the caller after use.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal(), and Xapian::Internal::QueryWildcard::postlist().

◆ open_document()

virtual Xapian::Document::Internal* Xapian::Database::Internal::open_document ( Xapian::docid  did,
bool  lazy 
) const
pure virtual

Open a document.

This is used to access the values and data associated with a document. See class Xapian::Document::Internal for further details.

Parameters
didThe document id which is being requested.
lazyNo need to check that this document actually exists. Used when we already know that this document exists (only a hint - the backend may still check).
Returns
A pointer to the newly created document object. This object must be deleted by the caller after use.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal().

◆ open_metadata_keylist()

TermList * Xapian::Database::Internal::open_metadata_keylist ( const std::string &  prefix) const
virtual

Open a termlist returning each metadata key.

Only metadata keys which are associated with a non-empty value will be returned.

Parameters
prefixIf non-empty, only keys with this prefix are returned.

Reimplemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Definition at line 298 of file database.cc.

Referenced by Internal().

◆ open_position_list()

virtual PositionList* Xapian::Database::Internal::open_position_list ( Xapian::docid  did,
const string &  tname 
) const
pure virtual

Open a position list for the given term in the given document.

Parameters
didThe document id for which a position list is being requested.
tnameThe term for which a position list is being requested.
Returns
A pointer to the newly created position list. This object must be deleted by the caller after use.

Implemented in GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal().

◆ open_post_list()

virtual LeafPostList* Xapian::Database::Internal::open_post_list ( const string &  tname) const
pure virtual

Open a posting list.

Method defined by subclass to open a posting list. This is a list of all the documents which contain a given term.

Parameters
tnameThe term whose posting list is being requested.
Returns
A pointer to the newly created posting list. If the term doesn't exist, a LeafPostList object returning no documents is returned, which makes it easier to implement a search over multiple databases. This object must be deleted by the caller after use.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Xapian::Database::compact_(), Internal(), Xapian::Internal::QueryValueRange::postlist(), Xapian::Internal::QueryValueLE::postlist(), and Xapian::Internal::QueryValueGE::postlist().

◆ open_spelling_termlist()

TermList * Xapian::Database::Internal::open_spelling_termlist ( const string &  word) const
virtual

Create a termlist tree from trigrams of word.

You can assume word.size() > 1.

If there are no trigrams, returns NULL.

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 217 of file database.cc.

Referenced by Internal().

◆ open_spelling_wordlist()

TermList * Xapian::Database::Internal::open_spelling_wordlist ( ) const
virtual

Return a termlist which returns the words which are spelling correction targets.

If there are no spelling correction targets, returns NULL.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, ChertDatabase, and GlassDatabase.

Definition at line 226 of file database.cc.

Referenced by Internal().

◆ open_synonym_keylist()

TermList * Xapian::Database::Internal::open_synonym_keylist ( const string &  prefix) const
virtual

Open a termlist returning each term which has synonyms.

Parameters
prefixIf non-empty, only terms with this prefix are returned.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, ChertDatabase, and GlassDatabase.

Definition at line 265 of file database.cc.

Referenced by Internal().

◆ open_synonym_termlist()

TermList * Xapian::Database::Internal::open_synonym_termlist ( const string &  term) const
virtual

Open a termlist returning synonyms for a term.

If term has no synonyms, returns NULL.

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 256 of file database.cc.

Referenced by Internal().

◆ open_term_list()

virtual TermList* Xapian::Database::Internal::open_term_list ( Xapian::docid  did) const
pure virtual

Open a term list.

This is a list of all the terms contained by a given document.

Parameters
didThe document id whose term list is being requested.
Returns
A pointer to the newly created term list. This object must be deleted by the caller after use.

Implemented in InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Xapian::Weight::Internal::accumulate_stats(), and Internal().

◆ open_value_list()

ValueList * Xapian::Database::Internal::open_value_list ( Xapian::valueno  slot) const
virtual

Open a value stream.

This returns the value in a particular slot for each document.

Parameters
slotThe value slot.
Returns
Pointer to a new ValueList object which should be deleted by the caller once it is no longer needed.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, ChertDatabase, and GlassDatabase.

Definition at line 211 of file database.cc.

Referenced by Internal().

◆ operator=()

void Xapian::Database::Internal::operator= ( const Internal )
private

Assignment is not allowed.

◆ readahead_for_query()

void Xapian::Database::Internal::readahead_for_query ( const Xapian::Query query)
virtual

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 54 of file database.cc.

Referenced by Internal(), and MultiMatch::MultiMatch().

◆ remove_spelling()

void Xapian::Database::Internal::remove_spelling ( const string &  word,
Xapian::termcount  freqdec 
) const
virtual

Remove a word from the spelling dictionary.

The word's frequency is decreased, and if would become zero or less then the word is removed completely.

Parameters
wordThe word to remove.
freqdecHow much to decrease its frequency by.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, and RemoteDatabase.

Definition at line 250 of file database.cc.

Referenced by Internal().

◆ remove_synonym()

void Xapian::Database::Internal::remove_synonym ( const string &  term,
const string &  synonym 
) const
virtual

Remove a synonym for a term.

If synonym isn't a synonym for term, then no action is taken.

Reimplemented in ChertWritableDatabase, and GlassWritableDatabase.

Definition at line 280 of file database.cc.

Referenced by Internal().

◆ reopen()

bool Xapian::Database::Internal::reopen ( )
virtual

Reopen the database to the latest available revision.

Database backends which don't support simultaneous update and reading probably don't need to do anything here.

Reimplemented in InMemoryDatabase, RemoteDatabase, ChertDatabase, and GlassDatabase.

Definition at line 312 of file database.cc.

Referenced by Internal().

◆ replace_document() [1/2]

void Xapian::Database::Internal::replace_document ( Xapian::docid  did,
const Xapian::Document document 
)
virtual

Replace a given document in the database.

See WritableDatabase::replace_document() for more information.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, and RemoteDatabase.

Definition at line 186 of file database.cc.

References Assert.

Referenced by Internal().

◆ replace_document() [2/2]

Xapian::docid Xapian::Database::Internal::replace_document ( const string &  unique_term,
const Xapian::Document document 
)
virtual

Replace any documents matching a term.

See WritableDatabase::replace_document() for more information.

Reimplemented in RemoteDatabase.

Definition at line 193 of file database.cc.

References Xapian::PostingIterator::Internal::at_end(), Xapian::PostingIterator::Internal::get_docid(), and Xapian::PostingIterator::Internal::next().

◆ request_document()

void Xapian::Database::Internal::request_document ( Xapian::docid  ) const
virtual

Request and later collect a document from the database.

Multiple documents can be requested with request_document(), and then collected with collect_document(). Allows the backend to optimise (e.g. the remote backend can start requests for all the documents so they fetch in parallel).

If a backend doesn't support this, request_document() can be a no-op and collect_document() the same as open_document().

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 321 of file database.cc.

Referenced by Internal().

◆ set_metadata()

void Xapian::Database::Internal::set_metadata ( const string &  key,
const string &  value 
)
virtual

Set the metadata associated with a given key.

See WritableDatabase::set_metadata() for more information.

Reimplemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, and RemoteDatabase.

Definition at line 306 of file database.cc.

Referenced by Internal().

◆ term_exists()

virtual bool Xapian::Database::Internal::term_exists ( const string &  tname) const
pure virtual

Check whether a given term is in the database.

Parameters
tnameThe term whose presence is being checked.

Implemented in ChertWritableDatabase, GlassWritableDatabase, InMemoryDatabase, ChertDatabase, GlassDatabase, and RemoteDatabase.

Referenced by Internal().

◆ transaction_active()

bool Xapian::Database::Internal::transaction_active ( ) const
inlineprotected

◆ write_changesets_to_fd()

void Xapian::Database::Internal::write_changesets_to_fd ( int  fd,
const std::string &  start_revision,
bool  need_whole_db,
Xapian::ReplicationInfo info 
)
virtual

Write a set of changesets to a file descriptor.

This call may reopen the database, leaving it pointing to a more recent version of the database.

Reimplemented in ChertDatabase, and GlassDatabase.

Definition at line 335 of file database.cc.

Referenced by Internal().

Member Data Documentation

◆ transaction_state

enum { ... } Xapian::Database::Internal::transaction_state

The documentation for this class was generated from the following files: