|
xapian-core
2.0.0
|
RemoteDatabase is the baseclass for remote database implementations. More...
#include <remote-database.h>
Inheritance diagram for RemoteDatabase:
Collaboration diagram for RemoteDatabase:Public Types | |
| typedef Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy > | opt_ptr_spy |
Public Types inherited from Xapian::Database::Internal | |
| typedef Xapian::doccount | size_type |
Public Member Functions | |
| Xapian::termcount | positionlist_count (Xapian::docid did, std::string_view term) const |
| Get the length of the position list. More... | |
| void | keep_alive () |
| Send a keep-alive message. More... | |
| void | set_query (const Xapian::Query &query, Xapian::termcount qlen, Xapian::valueno collapse_key, Xapian::doccount collapse_max, 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_threshold, double weight_threshold, const Xapian::Weight &wtscheme, const Xapian::RSet &omrset, const std::vector< opt_ptr_spy > &matchspies) const |
| Set the query. More... | |
| int | get_read_fd () const |
| Get the underlying fd this remote connection reads from. More... | |
| void | accumulate_remote_stats (Xapian::Weight::Internal &total) const |
| Accumulate stats from the remote server. More... | |
| void | send_global_stats (Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount check_at_least, const Xapian::KeyMaker *sorter, const Xapian::Weight::Internal &stats) const |
| Send the global stats to the remote server. More... | |
| Xapian::MSet | get_mset (const std::vector< opt_ptr_spy > &matchspies) const |
| Get the MSet from the remote server. More... | |
| TermList * | open_metadata_keylist (std::string_view prefix) const |
| Get remote metadata key list. More... | |
| TermList * | open_term_list (Xapian::docid did) const |
| Get remote termlist. More... | |
| TermList * | open_term_list_direct (Xapian::docid did) const |
| Like open_term_list() but without MultiTermList wrapper. More... | |
| TermList * | open_allterms (std::string_view 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... | |
| PostList * | open_post_list (std::string_view term) const |
| Return a PostList suitable for use in a PostingIterator. More... | |
| LeafPostList * | open_leaf_post_list (std::string_view term, bool) const |
| Create a LeafPostList for use during a match. More... | |
| Xapian::doccount | read_post_list (const std::string &term, NetworkPostList &pl) const |
| PositionList * | open_position_list (Xapian::docid did, std::string_view tname) const |
| 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 |
| Xapian::termcount | get_unique_terms (Xapian::docid did) const |
| Get the number of unique terms in document. More... | |
| Xapian::termcount | get_wdfdocmax (Xapian::docid did) const |
| Get the max wdf in document. More... | |
| bool | term_exists (std::string_view term) const |
| Check if term exists. More... | |
| void | get_freqs (std::string_view 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 (std::string_view 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) |
| void | delete_document (Xapian::docid did) |
| void | delete_document (std::string_view unique_term) |
| Delete any documents indexed by a term from the database. More... | |
| void | replace_document (Xapian::docid did, const Xapian::Document &doc) |
| Xapian::docid | replace_document (std::string_view 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... | |
| std::string | get_metadata (std::string_view key) const |
| Get the metadata associated with a given key. More... | |
| void | set_metadata (std::string_view key, std::string_view value) |
| Set the metadata associated with a given key. More... | |
| void | request_document (Xapian::docid did) const |
| Request a document. More... | |
| void | add_spelling (std::string_view word, Xapian::termcount freqinc) const |
| Add a word to the spelling dictionary. More... | |
| TermList * | open_synonym_termlist (std::string_view term) const |
| Open a termlist returning synonyms for a term. More... | |
| TermList * | open_synonym_keylist (std::string_view prefix) const |
| Open a termlist returning each term which has synonyms. More... | |
| void | add_synonym (std::string_view word, std::string_view synonym) const |
| Add a synonym for a term. More... | |
| void | remove_synonym (std::string_view word, std::string_view synonym) const |
| Remove a synonym for a term. More... | |
| void | clear_synonyms (std::string_view word) const |
| Clear all synonyms for a term. More... | |
| Xapian::termcount | remove_spelling (std::string_view word, Xapian::termcount freqdec) const |
| Remove a word from the spelling dictionary. More... | |
| int | get_backend_info (std::string *path) const |
| Get backend information about this database. More... | |
| bool | locked () const |
| Return true if the database is open for writing. More... | |
| std::string | reconstruct_text (Xapian::docid did, size_t length, std::string_view prefix, Xapian::termpos start_pos, Xapian::termpos end_pos) const |
| std::string | get_description () const |
| Return a string describing this object. More... | |
Public Member Functions inherited from Xapian::Database::Internal | |
| virtual | ~Internal () |
| We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor. More... | |
| virtual size_type | size () const |
| virtual void | readahead_for_query (const Query &query) const |
| virtual termcount | get_unique_terms_lower_bound () const |
| Get a lower bound on the unique terms size of a document in this DB. More... | |
| virtual termcount | get_unique_terms_upper_bound () const |
| Get an upper bound on the unique terms size of a document in this DB. More... | |
| virtual ValueList * | open_value_list (valueno slot) const |
| Open a value stream. More... | |
| virtual TermList * | open_spelling_termlist (std::string_view 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 doccount | get_spelling_frequency (std::string_view word) const |
| Return the number of times word was added as a spelling. More... | |
| virtual void | begin_transaction (bool flushed) |
| Begin transaction. More... | |
| virtual void | end_transaction (bool do_commit) |
| End transaction. More... | |
| 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. More... | |
| virtual Xapian::rev | get_revision () const |
| Get revision number of database (if meaningful). More... | |
| virtual void | invalidate_doc_object (Document::Internal *obj) const |
| Notify the database that document is no longer valid. More... | |
| virtual void | get_used_docid_range (docid &first, docid &last) const |
| Find lowest and highest docids actually in use. More... | |
| virtual Internal * | update_lock (int flags) |
| Lock a read-only database for writing or unlock a writable database. More... | |
Public Member Functions inherited from Xapian::Internal::intrusive_base | |
| intrusive_base () | |
| Construct with no references. More... | |
Protected Member Functions | |
| RemoteDatabase (std::pair< int, std::string > fd_and_context, double timeout_, 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, std::string_view data) const |
| Send a message to the server. More... | |
| void | do_close () |
| Close the socket. More... | |
| bool | get_posting (Xapian::docid &did, double &w, std::string &value) |
Protected Member Functions inherited from Xapian::Database::Internal | |
| Internal (transaction_state transaction_support) | |
| Only constructable as a base class for derived classes. More... | |
| bool | is_read_only () const |
| Test if this shard is read-only. More... | |
| bool | transaction_active () const |
| Test if a transaction is currently active. More... | |
| void | dtor_called () |
| Helper to process uncommitted changes when a writable db is destroyed. More... | |
Protected Attributes | |
| double | timeout |
| The timeout value used in network communications, in seconds. More... | |
Protected Attributes inherited from Xapian::Database::Internal | |
| transaction_state | state |
| Current 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... | |
| bool | pending_reply = false |
| Are we currently expecting a reply? More... | |
| std::string | uuid |
| The UUID of the remote database. 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_state { TRANSACTION_READONLY = -2 , TRANSACTION_UNIMPLEMENTED = -1 , TRANSACTION_NONE = 0 , TRANSACTION_UNFLUSHED = 1 , TRANSACTION_FLUSHED = 2 } |
| Transaction state enum. 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 47 of file remote-database.h.
Definition at line 171 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_and_context | A std::pair containing the file descriptor for the connection to the server and a context string to return with any error messages. (These are passed together so the caller can return them from a single helper function easily). |
| 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. |
| writable | Is this a WritableDatabase? |
| flags | Xapian::DB_RETRY_LOCK or 0. |
| void RemoteDatabase::accumulate_remote_stats | ( | Xapian::Weight::Internal & | total | ) | const |
Accumulate stats from the remote server.
Definition at line 727 of file remote-database.cc.
References get_message(), p, REPLY_STATS, and unserialise_stats().
Referenced by RemoteSubMatch::prepare_match().
|
virtual |
Reimplemented from Xapian::Database::Internal.
Definition at line 812 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, get_message(), mru_slot, MSG_ADDDOCUMENT, p, REPLY_ADDDOCUMENT, send_message(), serialise_document(), uncommitted_changes, unpack_throw_serialisation_error(), and unpack_uint_last().
|
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 939 of file remote-database.cc.
References get_message(), MSG_ADDSPELLING, pack_uint(), REPLY_DONE, send_message(), and uncommitted_changes.
|
virtual |
Add a synonym for a term.
If synonym is already a synonym for term, then no action is taken.
Reimplemented from Xapian::Database::Internal.
Definition at line 993 of file remote-database.cc.
References get_message(), MSG_ADDSYNONYM, pack_string(), REPLY_DONE, send_message(), and uncommitted_changes.
|
virtual |
Cancel pending modifications to the database.
Reimplemented from Xapian::Database::Internal.
Definition at line 797 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 |
Clear all synonyms for a term.
If term has no synonyms, no action is taken.
Reimplemented from Xapian::Database::Internal.
Definition at line 1017 of file remote-database.cc.
References get_message(), MSG_CLEARSYNONYMS, REPLY_DONE, send_message(), and uncommitted_changes.
|
virtual |
Close the database.
Implements Xapian::Database::Internal.
Definition at line 286 of file remote-database.cc.
References do_close().
|
virtual |
Commit pending modifications to the database.
Reimplemented from Xapian::Database::Internal.
Definition at line 783 of file remote-database.cc.
References get_message(), MSG_COMMIT, REPLY_DONE, send_message(), and uncommitted_changes.
Referenced by do_close().
|
virtual |
Delete any documents indexed by a term from the database.
Reimplemented from Xapian::Database::Internal.
Definition at line 847 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.
|
virtual |
Reimplemented from Xapian::Database::Internal.
Definition at line 833 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, get_message(), mru_slot, MSG_DELETEDOCUMENT, pack_uint_last(), REPLY_DONE, send_message(), and uncommitted_changes.
|
protected |
Close the socket.
Definition at line 649 of file remote-database.cc.
References commit(), RemoteConnection::do_close(), Xapian::Database::Internal::end_transaction(), Xapian::Database::Internal::is_read_only(), link, RemoteConnection::shutdown(), and Xapian::Database::Internal::transaction_active().
Referenced by close().
|
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 to some string describing the database in a backend-specified format if "path" isn't a concept which makes sense). |
Implements Xapian::Database::Internal.
Definition at line 324 of file remote-database.h.
References BACKEND_REMOTE, RemoteConnection::get_context(), and link.
|
virtual |
Return a string describing this object.
Implements Xapian::Database::Internal.
Definition at line 1052 of file remote-database.cc.
References RemoteConnection::get_context(), and link.
|
virtual |
Get the document count.
Implements Xapian::Database::Internal.
Definition at line 402 of file remote-database.cc.
References cached_stats_valid, doccount, and update_stats().
Referenced by term_exists().
|
virtual |
Implements Xapian::Database::Internal.
Definition at line 541 of file remote-database.cc.
References Assert, RemoteConnection::get_context(), get_message(), link, MSG_DOCLENGTH, p, pack_uint_last(), REPLY_DOCLENGTH, send_message(), and unpack_uint_last().
|
virtual |
Get a lower bound on the length of a document in this DB.
This bound does not include any zero-length documents.
Implements Xapian::Database::Internal.
Definition at line 519 of file remote-database.cc.
References doclen_lbound.
|
virtual |
Get an upper bound on the length of a document in this DB.
Implements Xapian::Database::Internal.
Definition at line 525 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 437 of file remote-database.cc.
References Assert, RemoteConnection::get_context(), get_message(), link, MSG_COLLFREQ, MSG_FREQS, MSG_TERMFREQ, p, REPLY_COLLFREQ, REPLY_FREQS, REPLY_TERMFREQ, send_message(), term, unpack_uint(), and unpack_uint_last().
|
virtual |
Get the last used docid.
Implements Xapian::Database::Internal.
Definition at line 409 of file remote-database.cc.
References cached_stats_valid, lastdocid, and update_stats().
|
inlineprotected |
Definition at line 139 of file remote-database.h.
References get_message().
|
protected |
Receive a message from the server.
Definition at line 595 of file remote-database.cc.
References RealTime::end_time(), RemoteConnection::get_context(), 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 accumulate_remote_stats(), add_document(), add_spelling(), add_synonym(), cancel(), clear_synonyms(), commit(), delete_document(), get_doclength(), get_freqs(), get_message(), get_message_or_done(), get_metadata(), get_mset(), get_unique_terms(), get_wdfdocmax(), keep_alive(), open_allterms(), open_document(), open_metadata_keylist(), open_position_list(), open_post_list(), open_synonym_keylist(), open_synonym_termlist(), open_term_list(), positionlist_count(), read_value_stats(), reconstruct_text(), remove_spelling(), remove_synonym(), replace_document(), request_document(), set_metadata(), and term_exists().
|
inlineprotected |
Definition at line 144 of file remote-database.h.
References get_message(), and REPLY_DONE.
Referenced by open_document(), 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 907 of file remote-database.cc.
References get_message(), MSG_GETMETADATA, REPLY_METADATA, and send_message().
| Xapian::MSet RemoteDatabase::get_mset | ( | const std::vector< opt_ptr_spy > & | matchspies | ) | const |
Get the MSet from the remote server.
Definition at line 763 of file remote-database.cc.
References get_message(), Xapian::MSet::internal, p, REPLY_RESULTS, and unpack_string().
Referenced by RemoteSubMatch::get_mset().
|
protected |
|
inline |
Get the underlying fd this remote connection reads from.
This allows the matcher to efficiently wait for remote databases to be ready in parallel using poll() or select().
Definition at line 212 of file remote-database.h.
References RemoteConnection::get_read_fd(), and link.
Referenced by RemoteSubMatch::get_read_fd().
|
virtual |
Return the total length of all documents in this database.
Implements Xapian::Database::Internal.
Definition at line 416 of file remote-database.cc.
References cached_stats_valid, total_length, and update_stats().
|
virtual |
Get the number of unique terms in document.
| did | The document id of the document to return this value for. |
Implements Xapian::Database::Internal.
Definition at line 559 of file remote-database.cc.
References Assert, RemoteConnection::get_context(), get_message(), link, MSG_UNIQUETERMS, p, pack_uint_last(), REPLY_UNIQUETERMS, send_message(), and unpack_uint_last().
|
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 901 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 498 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 505 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 512 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.
Implements Xapian::Database::Internal.
Definition at line 531 of file remote-database.cc.
References doclen_ubound.
|
virtual |
Get the max wdf in document.
| did | The document id of the document to return this value for. |
Implements Xapian::Database::Internal.
Definition at line 577 of file remote-database.cc.
References Assert, RemoteConnection::get_context(), get_message(), link, MSG_WDFDOCMAX, p, pack_uint_last(), REPLY_WDFDOCMAX, send_message(), and unpack_uint_last().
|
virtual |
Check whether this database contains any positional information.
Implements Xapian::Database::Internal.
Definition at line 272 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 143 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 1027 of file remote-database.cc.
|
virtual |
Iterate all terms.
Implements Xapian::Database::Internal.
Definition at line 193 of file remote-database.cc.
References get_message(), MSG_ALLTERMS, REPLY_ALLTERMS, and send_message().
|
virtual |
Get a remote document.
Implements Xapian::Database::Internal.
Definition at line 314 of file remote-database.cc.
References Assert, get_message(), get_message_or_done(), MSG_DOCUMENT, p, pack_uint_last(), REPLY_DOCDATA, REPLY_VALUE, send_message(), unpack_throw_serialisation_error(), and unpack_uint().
|
virtual |
Create a LeafPostList for use during a match.
| term | The term to open a postlist for, or the empty string to create an all-docs postlist. |
| need_read_pos | Does the postlist need to support read_position_list()? Note that open_position_list() may still be called even if need_read_pos is false. |
Implements Xapian::Database::Internal.
Definition at line 235 of file remote-database.cc.
References Assert.
|
virtual |
Get remote metadata key list.
Reimplemented from Xapian::Database::Internal.
Definition at line 151 of file remote-database.cc.
References get_message(), MSG_METADATAKEYLIST, REPLY_METADATAKEYLIST, and send_message().
|
virtual |
Implements Xapian::Database::Internal.
Definition at line 244 of file remote-database.cc.
References get_message(), MSG_POSITIONLIST, p, pack_uint(), Xapian::Vec< T, COW, UNIQUEPTR, typename >::push_back(), REPLY_POSITIONLIST, send_message(), term, unpack_throw_serialisation_error(), unpack_uint(), and UNSIGNED_OVERFLOW_OK.
|
virtual |
Return a PostList suitable for use in a PostingIterator.
Implements Xapian::Database::Internal.
Definition at line 202 of file remote-database.cc.
References cached_stats_valid, doccount, get_message(), lastdocid, MSG_POSTLIST, p, rare, REPLY_POSTLIST, REPLY_POSTLISTHEADER, send_message(), term, unpack_throw_serialisation_error(), unpack_uint_last(), and update_stats().
|
virtual |
Open a termlist returning each term which has synonyms.
| prefix | If non-empty, only terms with this prefix are returned. |
Reimplemented from Xapian::Database::Internal.
Definition at line 984 of file remote-database.cc.
References get_message(), MSG_SYNONYMKEYLIST, REPLY_SYNONYMKEYLIST, and send_message().
|
virtual |
Open a termlist returning synonyms for a term.
If term has no synonyms, returns NULL.
Reimplemented from Xapian::Database::Internal.
Definition at line 975 of file remote-database.cc.
References get_message(), MSG_SYNONYMTERMLIST, REPLY_SYNONYMTERMLIST, and send_message().
|
virtual |
Get remote termlist.
Implements Xapian::Database::Internal.
Definition at line 160 of file remote-database.cc.
References Assert, cached_stats_valid, doccount, RemoteConnection::get_context(), get_message(), link, MSG_TERMLIST, p, pack_uint_last(), REPLY_TERMLIST, REPLY_TERMLISTHEADER, send_message(), unpack_uint(), unpack_uint_last(), and update_stats().
Referenced by open_term_list_direct().
|
virtual |
Like open_term_list() but without MultiTermList wrapper.
MultiDatabase::open_term_list() wraps the returns TermList in a MultiTermList, but we don't want that for query expansion.
Implements Xapian::Database::Internal.
Definition at line 187 of file remote-database.cc.
References open_term_list().
|
private |
Don't allow assignment.
| Xapian::termcount RemoteDatabase::positionlist_count | ( | Xapian::docid | did, |
| std::string_view | term | ||
| ) | const |
Get the length of the position list.
Extra method for RemoteDatabase.
Definition at line 120 of file remote-database.cc.
References cached_stats_valid, RemoteConnection::get_context(), get_message(), has_positional_info, link, MSG_POSITIONLISTCOUNT, p, pack_uint(), REPLY_POSITIONLISTCOUNT, send_message(), term, and unpack_uint_last().
| Xapian::doccount RemoteDatabase::read_post_list | ( | const std::string & | term, |
| NetworkPostList & | pl | ||
| ) | const |
| void RemoteDatabase::read_value_stats | ( | Xapian::valueno | slot | ) | const |
Read the value statistics for a value from a remote database.
Definition at line 477 of file remote-database.cc.
References ValueStats::freq, RemoteConnection::get_context(), get_message(), link, ValueStats::lower_bound, mru_slot, mru_valstats, MSG_VALUESTATS, p, pack_uint_last(), REPLY_VALUESTATS, send_message(), unpack_string(), unpack_uint(), and ValueStats::upper_bound.
Referenced by get_value_freq(), get_value_lower_bound(), and get_value_upper_bound().
|
virtual |
Reimplemented from Xapian::Database::Internal.
Definition at line 1033 of file remote-database.cc.
References get_message(), MSG_RECONSTRUCTTEXT, pack_uint(), REPLY_RECONSTRUCTTEXT, and send_message().
|
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 953 of file remote-database.cc.
References RemoteConnection::get_context(), get_message(), link, MSG_REMOVESPELLING, p, pack_uint(), REPLY_REMOVESPELLING, send_message(), uncommitted_changes, and unpack_uint_last().
|
virtual |
Remove a synonym for a term.
If synonym isn't a synonym for term, then no action is taken.
Reimplemented from Xapian::Database::Internal.
Definition at line 1005 of file remote-database.cc.
References get_message(), MSG_REMOVESYNONYM, pack_string(), REPLY_DONE, 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 279 of file remote-database.cc.
References Xapian::BAD_VALUENO, mru_slot, MSG_REOPEN, and update_stats().
|
virtual |
Replace any documents matching a term.
Reimplemented from Xapian::Database::Internal.
Definition at line 876 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, get_message(), mru_slot, MSG_REPLACEDOCUMENTTERM, p, pack_string(), REPLY_ADDDOCUMENT, send_message(), serialise_document(), uncommitted_changes, unpack_throw_serialisation_error(), and unpack_uint_last().
|
virtual |
Reimplemented from Xapian::Database::Internal.
Definition at line 859 of file remote-database.cc.
References Xapian::BAD_VALUENO, cached_stats_valid, get_message(), mru_slot, MSG_REPLACEDOCUMENT, pack_uint(), REPLY_DONE, send_message(), serialise_document(), and uncommitted_changes.
|
virtual |
Request a document.
This tells the database that we're going to want a particular document soon. It's just a hint which the backend may ignore, but for glass it issues a preread hint on the file with the document data in, and for the remote backend it might cause the document to be fetched asynchronously (this isn't currently implemented though).
It can be called for multiple documents in turn, and a common usage pattern would be to iterate over an MSet and request the documents, then iterate over it again to actually get and display them.
The default implementation is a no-op.
Reimplemented from Xapian::Database::Internal.
Definition at line 929 of file remote-database.cc.
References get_message(), MSG_REQUESTDOCUMENT, pack_uint(), REPLY_DONE, and send_message().
| void RemoteDatabase::send_global_stats | ( | Xapian::doccount | first, |
| Xapian::doccount | maxitems, | ||
| Xapian::doccount | check_at_least, | ||
| const Xapian::KeyMaker * | sorter, | ||
| const Xapian::Weight::Internal & | stats | ||
| ) | const |
Send the global stats to the remote server.
Definition at line 738 of file remote-database.cc.
References MSG_GETMSET, Xapian::KeyMaker::name(), pack_string(), pack_string_empty(), pack_uint(), send_message(), Xapian::KeyMaker::serialise(), serialise_stats(), and throw_invalid_operation().
Referenced by RemoteSubMatch::start_match().
|
protected |
Send a message to the server.
Definition at line 632 of file remote-database.cc.
References dummy, RealTime::end_time(), RemoteConnection::get_message(), is_intermediate_reply(), link, pending_reply, RemoteConnection::send_message(), throw_connection_closed_unexpectedly(), and timeout.
Referenced by add_document(), add_spelling(), add_synonym(), cancel(), clear_synonyms(), commit(), delete_document(), get_doclength(), get_freqs(), get_metadata(), get_unique_terms(), get_wdfdocmax(), keep_alive(), open_allterms(), open_document(), open_metadata_keylist(), open_position_list(), open_post_list(), open_synonym_keylist(), open_synonym_termlist(), open_term_list(), positionlist_count(), read_value_stats(), reconstruct_text(), remove_spelling(), remove_synonym(), replace_document(), request_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 916 of file remote-database.cc.
References get_message(), MSG_SETMETADATA, pack_string(), REPLY_DONE, send_message(), and uncommitted_changes.
| void RemoteDatabase::set_query | ( | const Xapian::Query & | query, |
| Xapian::termcount | qlen, | ||
| Xapian::valueno | collapse_key, | ||
| Xapian::doccount | collapse_max, | ||
| 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_threshold, | ||
| double | weight_threshold, | ||
| const Xapian::Weight & | wtscheme, | ||
| const Xapian::RSet & | omrset, | ||
| const std::vector< opt_ptr_spy > & | matchspies | ||
| ) | const |
Set the query.
| query | The query. |
| qlen | The query length. |
| collapse_key | The value number to collapse matches on. |
| collapse_max | Max number of items with the same key to leave after collapsing (0 for don't collapse). |
| 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_threshold | Lower bound on percentage score. |
| weight_threshold | Lower bound on weight. |
| wtscheme | Weighting scheme. |
| omrset | The rset. |
| matchspies | The matchspies to use. |
Definition at line 677 of file remote-database.cc.
References MSG_QUERY, Xapian::Weight::name(), pack_bool(), pack_string(), pack_uint(), query(), Xapian::Enquire::Internal::REL, send_message(), Xapian::Query::serialise(), Xapian::Weight::serialise(), serialise_double(), and serialise_rset().
|
virtual |
Check if term exists.
Implements Xapian::Database::Internal.
Definition at line 423 of file remote-database.cc.
References get_doccount(), get_message(), MSG_TERMEXISTS, REPLY_TERMDOESNTEXIST, REPLY_TERMEXISTS, send_message(), and term.
|
private |
Definition at line 341 of file remote-database.cc.
References cached_stats_valid, doccount, doclen_lbound, doclen_ubound, RemoteConnection::get_context(), get_message_or_done(), has_positional_info, lastdocid, link, MSG_MAX, p, REPLY_UPDATE, send_message(), Xapian::Internal::str(), STRINGIZE, throw_handshake_failed(), total_length, unpack_bool(), unpack_uint(), uuid, XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION, and XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION.
Referenced by get_doccount(), get_lastdocid(), get_total_length(), has_positions(), open_post_list(), open_term_list(), and reopen().
|
mutableprivate |
Definition at line 88 of file remote-database.h.
Referenced by add_document(), cancel(), delete_document(), get_doccount(), get_lastdocid(), get_total_length(), has_positions(), open_post_list(), open_term_list(), positionlist_count(), replace_document(), and update_stats().
|
mutableprivate |
The remote document count, given at open.
Definition at line 58 of file remote-database.h.
Referenced by get_doccount(), open_post_list(), open_term_list(), and update_stats().
|
mutableprivate |
A lower bound on the smallest document length in this database.
Definition at line 64 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 67 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 73 of file remote-database.h.
Referenced by has_positions(), positionlist_count(), and update_stats().
|
mutableprivate |
The remote last docid, given at open.
Definition at line 61 of file remote-database.h.
Referenced by get_lastdocid(), open_post_list(), and update_stats().
|
mutableprivate |
The object which does the I/O.
Definition at line 55 of file remote-database.h.
Referenced by do_close(), get_backend_info(), get_description(), get_doclength(), get_freqs(), get_message(), get_read_fd(), get_unique_terms(), get_wdfdocmax(), open_term_list(), positionlist_count(), read_value_stats(), remove_spelling(), send_message(), and update_stats().
|
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 97 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 91 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.
Definition at line 83 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 158 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 70 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 105 of file remote-database.h.
Referenced by add_document(), add_spelling(), add_synonym(), cancel(), clear_synonyms(), commit(), delete_document(), remove_spelling(), remove_synonym(), replace_document(), and set_metadata().
|
mutableprivate |
The UUID of the remote database.
Definition at line 86 of file remote-database.h.
Referenced by get_uuid(), and update_stats().