xapian-core
1.4.26
|
RemoteDatabase is the baseclass for remote database implementations. More...
#include <remote-database.h>
Public Member Functions | |
void | keep_alive () |
Send a keep-alive message. More... | |
void | set_query (const Xapian::Query &query, Xapian::termcount qlen, Xapian::doccount collapse_max, Xapian::valueno collapse_key, Xapian::Enquire::docid_order order, Xapian::valueno sort_key, Xapian::Enquire::Internal::sort_setting sort_by, bool sort_value_forward, double time_limit, int percent_cutoff, double weight_cutoff, const Xapian::Weight *wtscheme, const Xapian::RSet &omrset, const vector< Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy >> &matchspies) |
Set the query. More... | |
bool | get_remote_stats (bool nowait, Xapian::Weight::Internal &out) |
Get the stats from the remote server. More... | |
void | send_global_stats (Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount check_at_least, const Xapian::Weight::Internal &stats) |
Send the global stats to the remote server. More... | |
void | get_mset (Xapian::MSet &mset, const vector< Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy >> &matchspies) |
Get the MSet from the remote server. More... | |
TermList * | open_metadata_keylist (const std::string &prefix) const |
Get remote metadata key list. More... | |
TermList * | open_term_list (Xapian::docid did) const |
Get remote termlist. More... | |
TermList * | open_allterms (const string &prefix) const |
Iterate all terms. More... | |
bool | has_positions () const |
Check whether this database contains any positional information. More... | |
bool | reopen () |
Reopen the database to the latest available revision. More... | |
void | close () |
Close the database. More... | |
LeafPostList * | open_post_list (const string &tname) const |
Open a posting list. More... | |
Xapian::doccount | read_post_list (const string &term, NetworkPostList &pl) const |
PositionList * | open_position_list (Xapian::docid did, const string &tname) const |
Open a position list for the given term in the given document. More... | |
Xapian::Document::Internal * | open_document (Xapian::docid did, bool lazy) const |
Get a remote document. More... | |
Xapian::doccount | get_doccount () const |
Get the document count. More... | |
Xapian::docid | get_lastdocid () const |
Get the last used docid. More... | |
Xapian::totallength | get_total_length () const |
Return the total length of all documents in this database. More... | |
Xapian::termcount | get_doclength (Xapian::docid did) const |
Get the length of a given document. More... | |
Xapian::termcount | get_unique_terms (Xapian::docid did) const |
Get the number of unique term in document. More... | |
bool | term_exists (const string &tname) const |
Check if term exists. More... | |
void | get_freqs (const string &term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const |
Returns frequencies for a term. More... | |
void | read_value_stats (Xapian::valueno slot) const |
Read the value statistics for a value from a remote database. More... | |
Xapian::doccount | get_value_freq (Xapian::valueno slot) const |
Return the frequency of a given value slot. More... | |
std::string | get_value_lower_bound (Xapian::valueno slot) const |
Get a lower bound on the values stored in the given value slot. More... | |
std::string | get_value_upper_bound (Xapian::valueno slot) const |
Get an upper bound on the values stored in the given value slot. More... | |
Xapian::termcount | get_doclength_lower_bound () const |
Get a lower bound on the length of a document in this DB. More... | |
Xapian::termcount | get_doclength_upper_bound () const |
Get an upper bound on the length of a document in this DB. More... | |
Xapian::termcount | get_wdf_upper_bound (const string &term) const |
Get an upper bound on the wdf of term term. More... | |
void | commit () |
Commit pending modifications to the database. More... | |
void | cancel () |
Cancel pending modifications to the database. More... | |
Xapian::docid | add_document (const Xapian::Document &doc) |
Add a new document to the database. More... | |
void | delete_document (Xapian::docid did) |
Delete a document in the database. More... | |
void | delete_document (const std::string &unique_term) |
Delete any documents indexed by a term from the database. More... | |
void | replace_document (Xapian::docid did, const Xapian::Document &doc) |
Replace a given document in the database. More... | |
Xapian::docid | replace_document (const std::string &unique_term, const Xapian::Document &document) |
Replace any documents matching a term. More... | |
std::string | get_uuid () const |
Get a UUID for the database. More... | |
string | get_metadata (const string &key) const |
Get the metadata associated with a given key. More... | |
void | set_metadata (const string &key, const string &value) |
Set the metadata associated with a given key. More... | |
void | add_spelling (const std::string &, Xapian::termcount) const |
Add a word to the spelling dictionary. More... | |
void | remove_spelling (const std::string &, Xapian::termcount freqdec) const |
Remove a word from the spelling dictionary. More... | |
int | get_backend_info (string *path) const |
Get backend information about this database. More... | |
bool | locked () const |
Return true if the database is open for writing. More... | |
Public Member Functions inherited from Xapian::Database::Internal | |
virtual | ~Internal () |
Destroy the database. More... | |
virtual void | readahead_for_query (const Xapian::Query &query) |
virtual ValueList * | open_value_list (Xapian::valueno slot) const |
Open a value stream. More... | |
virtual TermList * | open_spelling_termlist (const string &word) const |
Create a termlist tree from trigrams of word. More... | |
virtual TermList * | open_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 TermList * | open_synonym_termlist (const string &term) const |
Open a termlist returning synonyms for a term. More... | |
virtual TermList * | open_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... | |
void | begin_transaction (bool flushed) |
Begin a transaction. More... | |
void | commit_transaction () |
Commit a transaction. More... | |
void | cancel_transaction () |
Cancel a transaction. 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 void | invalidate_doc_object (Xapian::Document::Internal *obj) const |
Notify the database that document is no longer valid. More... | |
virtual void | get_used_docid_range (Xapian::docid &first, Xapian::docid &last) const |
Find lowest and highest docids actually in use. More... | |
virtual void | request_document (Xapian::docid) const |
Request and later collect a document from the database. More... | |
virtual Xapian::Document::Internal * | collect_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 Member Functions | |
RemoteDatabase (int fd, double timeout_, const string &context_, bool writable, int flags) | |
Constructor. More... | |
reply_type | get_message (std::string &message, reply_type required_type, reply_type required_type2) const |
Receive a message from the server. More... | |
void | get_message (std::string &message, reply_type required_type) const |
bool | get_message_or_done (std::string &message, reply_type required_type) const |
void | send_message (message_type type, const string &data) const |
Send a message to the server. More... | |
void | do_close () |
Close the socket. More... | |
bool | get_posting (Xapian::docid &did, double &w, string &value) |
Protected Member Functions inherited from Xapian::Database::Internal | |
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 | |
double | timeout |
The timeout value used in network communications, in seconds. More... | |
Protected Attributes inherited from Xapian::Database::Internal | |
enum Xapian::Database::Internal:: { ... } | transaction_state |
Transaction state. More... | |
Private Member Functions | |
void | operator= (const RemoteDatabase &) |
Don't allow assignment. More... | |
RemoteDatabase (const RemoteDatabase &) | |
Don't allow copying. More... | |
bool | update_stats (message_type msg_code=MSG_UPDATE, const std::string &body=std::string()) const |
Private Attributes | |
OwnedRemoteConnection | link |
The object which does the I/O. More... | |
Xapian::doccount | doccount |
The remote document count, given at open. More... | |
Xapian::docid | lastdocid |
The remote last docid, given at open. More... | |
Xapian::termcount | doclen_lbound |
A lower bound on the smallest document length in this database. More... | |
Xapian::termcount | doclen_ubound |
An upper bound on the greatest document length in this database. More... | |
Xapian::totallength | total_length |
The total length of all documents in this database. More... | |
bool | has_positional_info |
Has positional information? More... | |
int | pending_reply = -1 |
Are we currently expecting a reply? More... | |
string | uuid |
The UUID of the remote database. More... | |
string | context |
The context to return with any error messages. More... | |
bool | cached_stats_valid |
ValueStats | mru_valstats |
The most recently used value statistics. More... | |
Xapian::valueno | mru_slot |
The value slot for the most recently used value statistics. More... | |
bool | uncommitted_changes = false |
True if there are (or may be) uncommitted changes. More... | |
Additional Inherited Members | |
Public Attributes inherited from Xapian::Internal::intrusive_base | |
unsigned | _refs |
Reference count. More... | |
Protected Types inherited from Xapian::Database::Internal | |
enum | { TRANSACTION_UNIMPLEMENTED = -1, TRANSACTION_NONE = 0, TRANSACTION_UNFLUSHED = 1, TRANSACTION_FLUSHED = 2 } |
Transaction state. More... | |
RemoteDatabase is the baseclass for remote database implementations.
A subclass of this class is required which opens a TCP connection or pipe to the remote database server. This subclass works in combination with the RemoteSubMatch class during the match process.
Definition at line 45 of file remote-database.h.
|
private |
Don't allow copying.
|
protected |
Constructor.
The constructor is protected so that raw instances can't be created - a derived class must be instantiated which has code in the constructor to open the socket.
fd | The file descriptor for the connection to the server. |
timeout_ | The timeout used with the network operations. Generally a Xapian::NetworkTimeoutError exception will be thrown if the remote end doesn't respond for this length of time (in seconds). A timeout of 0 means that operations will never timeout. |
context_ | The context to return with any error messages. |
writable | Is this a WritableDatabase? |
flags | Xapian::DB_RETRY_LOCK or 0. |
Definition at line 86 of file remote-database.cc.
References Xapian::DB_RETRY_LOCK, encode_length(), MSG_MAX, MSG_WRITEACCESS, Xapian::Database::Internal::transaction_state, Xapian::Database::Internal::TRANSACTION_UNIMPLEMENTED, and update_stats().
|
virtual |
Add a new document to the database.
See WritableDatabase::add_document() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 792 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, decode_length(), get_message(), mru_slot, MSG_ADDDOCUMENT, REPLY_ADDDOCUMENT, send_message(), serialise_document(), and uncommitted_changes.
|
virtual |
Add a word to the spelling dictionary.
If the word is already present, its frequency is increased.
word | The word to add. |
freqinc | How much to increase its frequency by. |
Reimplemented from Xapian::Database::Internal.
Definition at line 902 of file remote-database.cc.
References dummy, encode_length(), get_message(), MSG_ADDSPELLING, REPLY_DONE, send_message(), and uncommitted_changes.
|
virtual |
Cancel pending modifications to the database.
Reimplemented from Xapian::Database::Internal.
Definition at line 777 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, dummy, get_message(), mru_slot, MSG_CANCEL, REPLY_DONE, send_message(), and uncommitted_changes.
|
virtual |
Close the database.
Implements Xapian::Database::Internal.
Definition at line 288 of file remote-database.cc.
References do_close().
Referenced by ProgClient::run_program().
|
virtual |
Commit pending modifications to the database.
See WritableDatabase::commit() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 763 of file remote-database.cc.
References get_message(), MSG_COMMIT, REPLY_DONE, send_message(), and uncommitted_changes.
Referenced by do_close().
|
virtual |
Delete a document in the database.
See WritableDatabase::delete_document() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 811 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, dummy, encode_length(), get_message(), mru_slot, MSG_DELETEDOCUMENT, REPLY_DONE, send_message(), and uncommitted_changes.
|
virtual |
Delete any documents indexed by a term from the database.
See WritableDatabase::delete_document() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 823 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, dummy, get_message(), mru_slot, MSG_DELETEDOCUMENTTERM, REPLY_DONE, send_message(), and uncommitted_changes.
|
protected |
Close the socket.
Definition at line 624 of file remote-database.cc.
References Xapian::Database::Internal::cancel_transaction(), commit(), RemoteConnection::do_close(), link, RemoteConnection::shutdown(), Xapian::Database::Internal::transaction_active(), Xapian::Database::Internal::transaction_state, and Xapian::Database::Internal::TRANSACTION_UNIMPLEMENTED.
Referenced by close(), and ProgClient::~ProgClient().
|
inlinevirtual |
Get backend information about this database.
path | If 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). |
Implements Xapian::Database::Internal.
Definition at line 291 of file remote-database.h.
References BACKEND_REMOTE.
|
virtual |
Get the document count.
Implements Xapian::Database::Internal.
Definition at line 399 of file remote-database.cc.
References cached_stats_valid, doccount, and update_stats().
|
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.
did | The document id of the document whose length is being requested. |
Implements Xapian::Database::Internal.
Definition at line 530 of file remote-database.cc.
References Assert, context, decode_length(), encode_length(), get_message(), MSG_DOCLENGTH, REPLY_DOCLENGTH, and send_message().
Referenced by NetworkPostList::NetworkPostList().
|
virtual |
Get a lower bound on the length of a document in this DB.
This bound does not include any zero-length documents.
Reimplemented from Xapian::Database::Internal.
Definition at line 508 of file remote-database.cc.
References doclen_lbound.
|
virtual |
Get an upper bound on the length of a document in this DB.
Reimplemented from Xapian::Database::Internal.
Definition at line 514 of file remote-database.cc.
References doclen_ubound.
|
virtual |
Returns frequencies for a term.
term | The term to get frequencies for |
termfreq_ptr | Point to return number of docs indexed by term (or NULL not to return) |
collfreq_ptr | Point to return number of occurrences of term in the database (or NULL not to return) |
Implements Xapian::Database::Internal.
Definition at line 432 of file remote-database.cc.
References Assert, decode_length(), get_message(), MSG_COLLFREQ, MSG_FREQS, MSG_TERMFREQ, REPLY_COLLFREQ, REPLY_FREQS, REPLY_TERMFREQ, and send_message().
|
virtual |
Get the last used docid.
Implements Xapian::Database::Internal.
Definition at line 406 of file remote-database.cc.
References cached_stats_valid, lastdocid, and update_stats().
|
protected |
Receive a message from the server.
Definition at line 564 of file remote-database.cc.
References context, RealTime::end_time(), RemoteConnection::get_message(), is_intermediate_reply(), link, pending_reply, rare, REPLY_EXCEPTION, REPLY_MAX, REPLY_UPDATE, Xapian::Internal::str(), throw_connection_closed_unexpectedly(), throw_handshake_failed(), timeout, and unserialise_error().
Referenced by add_document(), add_spelling(), cancel(), commit(), delete_document(), get_doclength(), get_freqs(), get_metadata(), get_mset(), get_remote_stats(), get_unique_terms(), keep_alive(), open_document(), open_term_list(), read_post_list(), read_value_stats(), replace_document(), set_metadata(), and term_exists().
|
inlineprotected |
Definition at line 140 of file remote-database.h.
|
inlineprotected |
Definition at line 145 of file remote-database.h.
References REPLY_DONE.
Referenced by open_allterms(), open_document(), open_metadata_keylist(), open_position_list(), open_term_list(), read_post_list(), and update_stats().
|
virtual |
Get the metadata associated with a given key.
See Database::get_metadata() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 880 of file remote-database.cc.
References get_message(), MSG_GETMETADATA, REPLY_METADATA, and send_message().
void RemoteDatabase::get_mset | ( | Xapian::MSet & | mset, |
const vector< Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy >> & | matchspies | ||
) |
Get the MSet from the remote server.
Definition at line 742 of file remote-database.cc.
References decode_length_and_check(), get_message(), REPLY_RESULTS, and unserialise_mset().
Referenced by RemoteSubMatch::get_mset(), and RemoteSubMatch::get_postlist().
|
protected |
bool RemoteDatabase::get_remote_stats | ( | bool | nowait, |
Xapian::Weight::Internal & | out | ||
) |
Get the stats from the remote server.
Definition at line 716 of file remote-database.cc.
References get_message(), link, RemoteConnection::ready_to_read(), REPLY_STATS, and unserialise_stats().
Referenced by RemoteSubMatch::prepare_match().
|
virtual |
Return the total length of all documents in this database.
Implements Xapian::Database::Internal.
Definition at line 413 of file remote-database.cc.
References cached_stats_valid, total_length, and update_stats().
|
virtual |
Get the number of unique term in document.
did | The document id of the document whose number of terms is being requested. |
Implements Xapian::Database::Internal.
Definition at line 547 of file remote-database.cc.
References Assert, context, decode_length(), encode_length(), get_message(), MSG_UNIQUETERMS, REPLY_UNIQUETERMS, and send_message().
Referenced by NetworkPostList::NetworkPostList().
|
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 from Xapian::Database::Internal.
Definition at line 874 of file remote-database.cc.
References uuid.
|
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.
slot | The value slot to examine. |
Implements Xapian::Database::Internal.
Definition at line 487 of file remote-database.cc.
References ValueStats::freq, mru_valstats, and read_value_stats().
|
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.
slot | The value slot to examine. |
Implements Xapian::Database::Internal.
Definition at line 494 of file remote-database.cc.
References ValueStats::lower_bound, mru_valstats, and read_value_stats().
|
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.
slot | The value slot to examine. |
Implements Xapian::Database::Internal.
Definition at line 501 of file remote-database.cc.
References mru_valstats, read_value_stats(), and ValueStats::upper_bound.
|
virtual |
Get an upper bound on the wdf of term term.
Reimplemented from Xapian::Database::Internal.
Definition at line 520 of file remote-database.cc.
References doclen_ubound.
Referenced by NetworkPostList::NetworkPostList().
|
virtual |
Check whether this database contains any positional information.
Implements Xapian::Database::Internal.
Definition at line 274 of file remote-database.cc.
References cached_stats_valid, has_positional_info, and update_stats().
|
virtual |
Send a keep-alive message.
Reimplemented from Xapian::Database::Internal.
Definition at line 118 of file remote-database.cc.
References get_message(), MSG_KEEPALIVE, REPLY_DONE, and send_message().
|
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 from Xapian::Database::Internal.
Definition at line 926 of file remote-database.cc.
|
virtual |
Iterate all terms.
Implements Xapian::Database::Internal.
Definition at line 197 of file remote-database.cc.
References cached_stats_valid, decode_length(), doccount, get_message_or_done(), MSG_ALLTERMS, REPLY_ALLTERMS, send_message(), NetworkTermListItem::termfreq, NetworkTermListItem::tname, and update_stats().
|
virtual |
Get a remote document.
Implements Xapian::Database::Internal.
Definition at line 316 of file remote-database.cc.
References Assert, decode_length(), encode_length(), get_message(), get_message_or_done(), MSG_DOCUMENT, REPLY_DOCDATA, REPLY_VALUE, and send_message().
|
virtual |
Get remote metadata key list.
Reimplemented from Xapian::Database::Internal.
Definition at line 126 of file remote-database.cc.
References cached_stats_valid, doccount, get_message_or_done(), MSG_METADATAKEYLIST, REPLY_METADATAKEYLIST, send_message(), NetworkTermListItem::tname, and update_stats().
|
virtual |
Open a position list for the given term in the given document.
did | The document id for which a position list is being requested. |
tname | The term for which a position list is being requested. |
Implements Xapian::Database::Internal.
Definition at line 253 of file remote-database.cc.
References decode_length(), encode_length(), get_message_or_done(), MSG_POSITIONLIST, REPLY_POSITIONLIST, and send_message().
Referenced by NetworkPostList::NetworkPostList(), and NetworkTermList::positionlist_begin().
|
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.
tname | The term whose posting list is being requested. |
Implements Xapian::Database::Internal.
Definition at line 227 of file remote-database.cc.
|
virtual |
Get remote termlist.
Implements Xapian::Database::Internal.
Definition at line 154 of file remote-database.cc.
References Assert, cached_stats_valid, context, decode_length(), doccount, encode_length(), get_message(), get_message_or_done(), MSG_TERMLIST, REPLY_DOCLENGTH, REPLY_TERMLIST, send_message(), NetworkTermListItem::termfreq, NetworkTermListItem::tname, update_stats(), and NetworkTermListItem::wdf.
|
private |
Don't allow assignment.
Xapian::doccount RemoteDatabase::read_post_list | ( | const string & | term, |
NetworkPostList & | pl | ||
) | const |
Definition at line 233 of file remote-database.cc.
References NetworkPostList::append_posting(), decode_length(), get_message(), get_message_or_done(), MSG_POSTLIST, REPLY_POSTLISTITEM, REPLY_POSTLISTSTART, and send_message().
Referenced by NetworkPostList::NetworkPostList().
void RemoteDatabase::read_value_stats | ( | Xapian::valueno | slot | ) | const |
Read the value statistics for a value from a remote database.
Definition at line 463 of file remote-database.cc.
References context, decode_length(), decode_length_and_check(), encode_length(), ValueStats::freq, get_message(), ValueStats::lower_bound, mru_slot, mru_valstats, MSG_VALUESTATS, REPLY_VALUESTATS, send_message(), and ValueStats::upper_bound.
Referenced by get_value_freq(), get_value_lower_bound(), and get_value_upper_bound().
|
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.
word | The word to remove. |
freqdec | How much to decrease its frequency by. |
Reimplemented from Xapian::Database::Internal.
Definition at line 915 of file remote-database.cc.
References encode_length(), MSG_REMOVESPELLING, send_message(), and uncommitted_changes.
|
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 from Xapian::Database::Internal.
Definition at line 281 of file remote-database.cc.
References Xapian::BAD_VALUENO, mru_slot, MSG_REOPEN, and update_stats().
|
virtual |
Replace a given document in the database.
See WritableDatabase::replace_document() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 835 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, dummy, encode_length(), get_message(), mru_slot, MSG_REPLACEDOCUMENT, REPLY_DONE, send_message(), serialise_document(), and uncommitted_changes.
|
virtual |
Replace any documents matching a term.
See WritableDatabase::replace_document() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 851 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, decode_length(), encode_length(), get_message(), mru_slot, MSG_REPLACEDOCUMENTTERM, REPLY_ADDDOCUMENT, send_message(), serialise_document(), and uncommitted_changes.
void RemoteDatabase::send_global_stats | ( | Xapian::doccount | first, |
Xapian::doccount | maxitems, | ||
Xapian::doccount | check_at_least, | ||
const Xapian::Weight::Internal & | stats | ||
) |
Send the global stats to the remote server.
Definition at line 729 of file remote-database.cc.
References encode_length(), MSG_GETMSET, send_message(), and serialise_stats().
Referenced by RemoteSubMatch::start_match().
|
protected |
Send a message to the server.
Definition at line 601 of file remote-database.cc.
References dummy, RealTime::end_time(), RemoteConnection::get_message(), is_intermediate_reply(), link, MSG_REMOVESPELLING, pending_reply, RemoteConnection::send_message(), throw_connection_closed_unexpectedly(), and timeout.
Referenced by add_document(), add_spelling(), cancel(), commit(), delete_document(), get_doclength(), get_freqs(), get_metadata(), get_unique_terms(), keep_alive(), open_allterms(), open_document(), open_metadata_keylist(), open_position_list(), open_term_list(), read_post_list(), read_value_stats(), remove_spelling(), replace_document(), send_global_stats(), set_metadata(), set_query(), term_exists(), and update_stats().
|
virtual |
Set the metadata associated with a given key.
See WritableDatabase::set_metadata() for more information.
Reimplemented from Xapian::Database::Internal.
Definition at line 889 of file remote-database.cc.
References dummy, encode_length(), get_message(), MSG_SETMETADATA, REPLY_DONE, send_message(), and uncommitted_changes.
void RemoteDatabase::set_query | ( | const Xapian::Query & | query, |
Xapian::termcount | qlen, | ||
Xapian::doccount | collapse_max, | ||
Xapian::valueno | collapse_key, | ||
Xapian::Enquire::docid_order | order, | ||
Xapian::valueno | sort_key, | ||
Xapian::Enquire::Internal::sort_setting | sort_by, | ||
bool | sort_value_forward, | ||
double | time_limit, | ||
int | percent_cutoff, | ||
double | weight_cutoff, | ||
const Xapian::Weight * | wtscheme, | ||
const Xapian::RSet & | omrset, | ||
const vector< Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy >> & | matchspies | ||
) |
Set the query.
query | The query. |
qlen | The query length. |
collapse_max | Max number of items with the same key to leave after collapsing (0 for don't collapse). |
collapse_key | The value number to collapse matches on. |
order | Sort order for docids. |
sort_key | The value number to sort on. |
sort_by | Which order to apply sorts in. |
sort_value_forward | Sort order for values. |
time_limit_ | Seconds to reduce check_at_least after (or <= 0 for no limit). |
percent_cutoff | Percentage cutoff. |
weight_cutoff | Weight cutoff. |
wtscheme | Weighting scheme. |
omrset | The rset. |
matchspies | The matchspies to use. |
Definition at line 657 of file remote-database.cc.
References encode_length(), MSG_QUERY, Xapian::Weight::name(), send_message(), Xapian::Weight::serialise(), Xapian::Query::serialise(), serialise_double(), and serialise_rset().
Referenced by MultiMatch::MultiMatch().
|
virtual |
Check if term exists.
Implements Xapian::Database::Internal.
Definition at line 420 of file remote-database.cc.
References Assert, get_message(), MSG_TERMEXISTS, REPLY_TERMDOESNTEXIST, REPLY_TERMEXISTS, and send_message().
|
private |
Definition at line 338 of file remote-database.cc.
References cached_stats_valid, context, decode_length(), doccount, doclen_lbound, doclen_ubound, get_message_or_done(), has_positional_info, lastdocid, MSG_MAX, REPLY_UPDATE, send_message(), Xapian::Internal::str(), STRINGIZE, throw_handshake_failed(), total_length, uuid, XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION, and XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION.
Referenced by get_doccount(), get_lastdocid(), get_total_length(), has_positions(), open_allterms(), open_metadata_keylist(), open_term_list(), RemoteDatabase(), and reopen().
|
mutableprivate |
Definition at line 95 of file remote-database.h.
Referenced by add_document(), cancel(), delete_document(), get_doccount(), get_lastdocid(), get_total_length(), has_positions(), open_allterms(), open_metadata_keylist(), open_term_list(), replace_document(), and update_stats().
|
private |
The context to return with any error messages.
Definition at line 93 of file remote-database.h.
Referenced by get_doclength(), get_message(), get_unique_terms(), is_intermediate_reply(), open_term_list(), read_value_stats(), and update_stats().
|
mutableprivate |
The remote document count, given at open.
Definition at line 56 of file remote-database.h.
Referenced by get_doccount(), open_allterms(), open_metadata_keylist(), open_term_list(), and update_stats().
|
mutableprivate |
A lower bound on the smallest document length in this database.
Definition at line 62 of file remote-database.h.
Referenced by get_doclength_lower_bound(), and update_stats().
|
mutableprivate |
An upper bound on the greatest document length in this database.
Definition at line 65 of file remote-database.h.
Referenced by get_doclength_upper_bound(), get_wdf_upper_bound(), and update_stats().
|
mutableprivate |
Has positional information?
Definition at line 71 of file remote-database.h.
Referenced by has_positions(), and update_stats().
|
mutableprivate |
The remote last docid, given at open.
Definition at line 59 of file remote-database.h.
Referenced by get_lastdocid(), and update_stats().
|
mutableprivate |
The object which does the I/O.
Definition at line 53 of file remote-database.h.
Referenced by do_close(), get_message(), get_remote_stats(), and send_message().
|
mutableprivate |
The value slot for the most recently used value statistics.
Set to BAD_VALUENO if no value statistics have yet been looked up.
Definition at line 104 of file remote-database.h.
Referenced by add_document(), cancel(), delete_document(), read_value_stats(), reopen(), and replace_document().
|
mutableprivate |
The most recently used value statistics.
Definition at line 98 of file remote-database.h.
Referenced by get_value_freq(), get_value_lower_bound(), get_value_upper_bound(), and read_value_stats().
|
mutableprivate |
Are we currently expecting a reply?
Our caller might send a message but then an exception (from another shard or locally) might cause it not to try to read the reply before sending another message. This flag allows us to detect that situation and discard the unwanted reply rather than trying to read it as the response to the new message.
Unhelpfully the remote protocol in 1.4.x can send REPLY_DOCLENGTH in response to MSG_DOCLENGTH (when it's a final reply) or in response to MSG_TERMLIST (when further replies are expected). To allow use to distinguish these cases, pending_reply is set to the MSG_* code, or -1 if we're not currently expecting a reply.
Definition at line 87 of file remote-database.h.
Referenced by get_message(), and send_message().
|
protected |
The timeout value used in network communications, in seconds.
Definition at line 159 of file remote-database.h.
Referenced by get_message(), and send_message().
|
mutableprivate |
The total length of all documents in this database.
Definition at line 68 of file remote-database.h.
Referenced by get_total_length(), and update_stats().
|
mutableprivate |
True if there are (or may be) uncommitted changes.
Used to optimise away commit()/cancel() calls. These can be explicit, but also can happen implicitly when the WritableDatabase destructor is called.
Definition at line 112 of file remote-database.h.
Referenced by add_document(), add_spelling(), cancel(), commit(), delete_document(), remove_spelling(), replace_document(), and set_metadata().
|
mutableprivate |
The UUID of the remote database.
Definition at line 90 of file remote-database.h.
Referenced by get_uuid(), and update_stats().