| database.h | | database.h | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| * USA | | * USA | |
| */ | | */ | |
| | | | |
| #ifndef XAPIAN_INCLUDED_DATABASE_H | | #ifndef XAPIAN_INCLUDED_DATABASE_H | |
| #define XAPIAN_INCLUDED_DATABASE_H | | #define XAPIAN_INCLUDED_DATABASE_H | |
| | | | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
| #include <xapian/base.h> | | #include <xapian/base.h> | |
|
| | | #include <xapian/document.h> | |
| #include <xapian/types.h> | | #include <xapian/types.h> | |
| #include <xapian/positioniterator.h> | | #include <xapian/positioniterator.h> | |
| #include <xapian/postingiterator.h> | | #include <xapian/postingiterator.h> | |
| #include <xapian/termiterator.h> | | #include <xapian/termiterator.h> | |
|
| | | #include <xapian/valueiterator.h> | |
| #include <xapian/visibility.h> | | #include <xapian/visibility.h> | |
| | | | |
|
| | | /// The Xapian library lives in the Xapian namespace. | |
| namespace Xapian { | | namespace Xapian { | |
| | | | |
|
| class Document; | | | |
| | | | |
| /** This class is used to access a database, or a group of databases. | | /** This class is used to access a database, or a group of databases. | |
| * | | * | |
| * For searching, this class is used in conjunction with an Enquire object
. | | * For searching, this class is used in conjunction with an Enquire object
. | |
| * | | * | |
| * @exception InvalidArgumentError will be thrown if an invalid | | * @exception InvalidArgumentError will be thrown if an invalid | |
| * argument is supplied, for example, an unknown database type. | | * argument is supplied, for example, an unknown database type. | |
| * | | * | |
| * @exception DatabaseOpeningError may be thrown if the database cannot | | * @exception DatabaseOpeningError may be thrown if the database cannot | |
| * be opened (for example, a required file cannot be found). | | * be opened (for example, a required file cannot be found). | |
| * | | * | |
| * @exception DatabaseVersionError may be thrown if the database is in an | | * @exception DatabaseVersionError may be thrown if the database is in an | |
| * unsupported format (for example, created by a newer version of Xapian | | * unsupported format (for example, created by a newer version of Xapian | |
| * which uses an incompatible format). | | * which uses an incompatible format). | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT Database { | | class XAPIAN_VISIBILITY_DEFAULT Database { | |
| public: | | public: | |
| class Internal; | | class Internal; | |
| /// @private @internal Reference counted internals. | | /// @private @internal Reference counted internals. | |
| std::vector<Xapian::Internal::RefCntPtr<Internal> > internal; | | std::vector<Xapian::Internal::RefCntPtr<Internal> > internal; | |
| | | | |
|
| | | /** @private @internal Get a document from the database, but doesn't | |
| | | * need to check if it exists. | |
| | | * | |
| | | * This method returns a Xapian::Document object which provides the | |
| | | * information about a document. If the document doesn't exist, | |
| | | * either a NULL pointer may be returned, or the returned object wi | |
| | | ll | |
| | | * throw DocNotFoundError when you try to access it. | |
| | | * | |
| | | * The caller should delete the returned object when it has finishe | |
| | | d | |
| | | * with it. | |
| | | * | |
| | | * @param did The document id of the document to retrieve. | |
| | | * | |
| | | * @return Pointer to Document::Internal object. | |
| | | */ | |
| | | Document::Internal * get_document_lazily(Xapian::docid did) const; | |
| | | | |
| /** Add an existing database (or group of databases) to those | | /** Add an existing database (or group of databases) to those | |
| * accessed by this object. | | * accessed by this object. | |
| * | | * | |
| * @param database the database(s) to add. | | * @param database the database(s) to add. | |
| */ | | */ | |
| void add_database(const Database & database); | | void add_database(const Database & database); | |
| | | | |
| /** Create a Database with no databases in. | | /** Create a Database with no databases in. | |
| */ | | */ | |
| Database(); | | Database(); | |
| | | | |
| skipping to change at line 102 | | skipping to change at line 120 | |
| * copying is cheap. | | * copying is cheap. | |
| */ | | */ | |
| Database(const Database &other); | | Database(const Database &other); | |
| | | | |
| /** Assignment is allowed. The internals are reference counted, | | /** Assignment is allowed. The internals are reference counted, | |
| * so assignment is cheap. | | * so assignment is cheap. | |
| */ | | */ | |
| void operator=(const Database &other); | | void operator=(const Database &other); | |
| | | | |
| /** Re-open the database. | | /** Re-open the database. | |
|
| | | * | |
| * This re-opens the database(s) to the latest available version(s)
. | | * This re-opens the database(s) to the latest available version(s)
. | |
|
| * It can be used either to make sure the latest results are | | * It can be used either to make sure the latest results are return | |
| * returned, or to recover from a Xapian::DatabaseModifiedError. | | ed, | |
| | | * or to recover from a Xapian::DatabaseModifiedError. | |
| | | * | |
| | | * Calling reopen() on a database which has been closed (with @a | |
| | | * close()) will always raise a Xapian::DatabaseError. | |
| */ | | */ | |
| void reopen(); | | void reopen(); | |
| | | | |
|
| | | /** Close the database. | |
| | | * | |
| | | * This closes the database and releases all file handles held by t | |
| | | he | |
| | | * database. | |
| | | * | |
| | | * This is a permanent close of the database: calling reopen() afte | |
| | | r | |
| | | * closing a database will not reopen it, and will raise an excepti | |
| | | on. | |
| | | * | |
| | | * Calling close() on a database which is already closed has no eff | |
| | | ect | |
| | | * (and doesn't raise an exception). | |
| | | * | |
| | | * After this call, calls made to methods of the database (other th | |
| | | an | |
| | | * close() or the destructor), or to objects associated with the | |
| | | * database will behave in one of the following ways (but which | |
| | | * behaviour happens may vary between releases, and between databas | |
| | | e | |
| | | * backends): | |
| | | * | |
| | | * - raise a Xapian::DatabaseError indicating that the database is | |
| | | * closed. | |
| | | * | |
| | | * - behave exactly as they would have done if the database had no | |
| | | t | |
| | | * been closed (by using cached data). | |
| | | * | |
| | | * To summarise - you should not rely on the exception being raised | |
| | | , | |
| | | * or the normal result being available, but if you do get a result | |
| | | , | |
| | | * it will be correct. | |
| | | */ | |
| | | virtual void close(); | |
| | | | |
| /// Return a string describing this object. | | /// Return a string describing this object. | |
| virtual std::string get_description() const; | | virtual std::string get_description() const; | |
| | | | |
| /** An iterator pointing to the start of the postlist | | /** An iterator pointing to the start of the postlist | |
| * for a given term. | | * for a given term. | |
| * | | * | |
| * If the term name is the empty string, the iterator returned | | * If the term name is the empty string, the iterator returned | |
| * will list all the documents in the database. Such an iterator | | * will list all the documents in the database. Such an iterator | |
| * will always return a WDF value of 1, since there is no obvious | | * will always return a WDF value of 1, since there is no obvious | |
| * meaning for this quantity in this case. | | * meaning for this quantity in this case. | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 220 | |
| return TermIterator(NULL); | | return TermIterator(NULL); | |
| } | | } | |
| | | | |
| /** An iterator which runs across all terms with a given prefix. | | /** An iterator which runs across all terms with a given prefix. | |
| * | | * | |
| * This is functionally similar to getting an iterator with | | * This is functionally similar to getting an iterator with | |
| * allterms_begin() and then calling skip_to(prefix) on that iterat
or | | * allterms_begin() and then calling skip_to(prefix) on that iterat
or | |
| * to move to the start of the prefix, but is more convenient (beca
use | | * to move to the start of the prefix, but is more convenient (beca
use | |
| * it detects the end of the prefixed terms), and may be more | | * it detects the end of the prefixed terms), and may be more | |
| * efficient than simply calling skip_to() after opening the iterat
or, | | * efficient than simply calling skip_to() after opening the iterat
or, | |
|
| * particularly for remote databases. | | * particularly for network databases. | |
| * | | * | |
| * @param prefix The prefix to restrict the returned terms to. | | * @param prefix The prefix to restrict the returned terms to. | |
| */ | | */ | |
| TermIterator allterms_begin(const std::string & prefix) const; | | TermIterator allterms_begin(const std::string & prefix) const; | |
| | | | |
| /** Corresponding end iterator to allterms_begin(prefix). | | /** Corresponding end iterator to allterms_begin(prefix). | |
| */ | | */ | |
| TermIterator allterms_end(const std::string &) const { | | TermIterator allterms_end(const std::string &) const { | |
| return TermIterator(NULL); | | return TermIterator(NULL); | |
| } | | } | |
| | | | |
| skipping to change at line 212 | | skipping to change at line 263 | |
| * | | * | |
| * This is the sum of the number of occurrences of the term in each | | * This is the sum of the number of occurrences of the term in each | |
| * document it indexes: i.e., the sum of the within document | | * document it indexes: i.e., the sum of the within document | |
| * frequencies of the term. | | * frequencies of the term. | |
| * | | * | |
| * @param tname The term whose collection frequency is being | | * @param tname The term whose collection frequency is being | |
| * requested. | | * requested. | |
| */ | | */ | |
| Xapian::termcount get_collection_freq(const std::string & tname) con
st; | | Xapian::termcount get_collection_freq(const std::string & tname) con
st; | |
| | | | |
|
| /** Get the length of a document. | | /** Return the frequency of a given value slot. | |
| | | * | |
| | | * This is the number of documents which have a (non-empty) value | |
| | | * stored in the slot. | |
| | | * | |
| | | * @param valno The value slot to examine. | |
| | | * | |
| | | * @exception UnimplementedError The frequency of the value isn't | |
| | | * available for this database type. | |
| */ | | */ | |
|
| Xapian::doclength get_doclength(Xapian::docid did) const; | | Xapian::doccount get_value_freq(Xapian::valueno valno) const; | |
| | | | |
|
| /** Send a "keep-alive" to remote databases to stop them timing | | /** Get a lower bound on the values stored in the given value slot. | |
| * out. | | * | |
| | | * If there are no values stored in the given value slot, this will | |
| | | * return an empty string. | |
| | | * | |
| | | * If the lower bound isn't available for the given database type, | |
| | | * this will return the lowest possible bound - the empty string. | |
| | | * | |
| | | * @param valno The value slot to examine. | |
| | | */ | |
| | | std::string get_value_lower_bound(Xapian::valueno valno) const; | |
| | | | |
| | | /** 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. | |
| | | * | |
| | | * @param valno The value slot to examine. | |
| | | * | |
| | | * @exception UnimplementedError The upper bound of the values isn' | |
| | | t | |
| | | * available for this database type. | |
| | | */ | |
| | | std::string get_value_upper_bound(Xapian::valueno valno) const; | |
| | | | |
| | | /** Get a lower bound on the length of a document in this DB. | |
| | | * | |
| | | * This bound does not include any zero-length documents. | |
| | | */ | |
| | | Xapian::termcount get_doclength_lower_bound() const; | |
| | | | |
| | | /// Get an upper bound on the length of a document in this DB. | |
| | | Xapian::termcount get_doclength_upper_bound() const; | |
| | | | |
| | | /// Get an upper bound on the wdf of term @a term. | |
| | | Xapian::termcount get_wdf_upper_bound(const std::string & term) cons | |
| | | t; | |
| | | | |
| | | /// Return an iterator over the value in slot @a slot for each docum | |
| | | ent. | |
| | | ValueIterator valuestream_begin(Xapian::valueno slot) const; | |
| | | | |
| | | /// Return end iterator corresponding to valuestream_begin(). | |
| | | ValueIteratorEnd_ valuestream_end(Xapian::valueno) const { | |
| | | return ValueIteratorEnd_(); | |
| | | } | |
| | | | |
| | | /// Get the length of a document. | |
| | | Xapian::termcount get_doclength(Xapian::docid did) const; | |
| | | | |
| | | /** Send a "keep-alive" to remote databases to stop them timing out. | |
| | | * | |
| | | * Has no effect on non-remote databases. | |
| */ | | */ | |
| void keep_alive(); | | void keep_alive(); | |
| | | | |
| /** Get a document from the database, given its document id. | | /** Get a document from the database, given its document id. | |
| * | | * | |
| * This method returns a Xapian::Document object which provides the | | * This method returns a Xapian::Document object which provides the | |
| * information about a document. | | * information about a document. | |
| * | | * | |
| * @param did The document id of the document to retrieve. | | * @param did The document id of the document to retrieve. | |
| * | | * | |
| | | | |
| skipping to change at line 276 | | skipping to change at line 383 | |
| /// Corresponding end iterator to synonyms_begin(term). | | /// Corresponding end iterator to synonyms_begin(term). | |
| Xapian::TermIterator synonyms_end(const std::string &) const { | | Xapian::TermIterator synonyms_end(const std::string &) const { | |
| return Xapian::TermIterator(NULL); | | return Xapian::TermIterator(NULL); | |
| } | | } | |
| | | | |
| /** An iterator which returns all terms which have synonyms. | | /** An iterator which returns all terms which have synonyms. | |
| * | | * | |
| * @param prefix If non-empty, only terms with this prefix are | | * @param prefix If non-empty, only terms with this prefix are | |
| * returned. | | * returned. | |
| */ | | */ | |
|
| Xapian::TermIterator synonym_keys_begin(const std::string &prefix =
"") const; | | Xapian::TermIterator synonym_keys_begin(const std::string &prefix =
std::string()) const; | |
| | | | |
| /// Corresponding end iterator to synonym_keys_begin(prefix). | | /// Corresponding end iterator to synonym_keys_begin(prefix). | |
|
| Xapian::TermIterator synonym_keys_end(const std::string & = "") cons
t { | | Xapian::TermIterator synonym_keys_end(const std::string & = std::str
ing()) const { | |
| return Xapian::TermIterator(NULL); | | return Xapian::TermIterator(NULL); | |
| } | | } | |
| | | | |
| /** Get the user-specified metadata associated with a given key. | | /** Get the user-specified metadata associated with a given key. | |
| * | | * | |
| * User-specified metadata allows you to store arbitrary informatio
n | | * User-specified metadata allows you to store arbitrary informatio
n | |
| * in the form of (key,tag) pairs. See @a | | * in the form of (key,tag) pairs. See @a | |
| * WritableDatabase::set_metadata() for more information. | | * WritableDatabase::set_metadata() for more information. | |
| * | | * | |
| * When invoked on a Xapian::Database object representing multiple | | * When invoked on a Xapian::Database object representing multiple | |
| | | | |
| skipping to change at line 327 | | skipping to change at line 434 | |
| * metadata_keys_end(). | | * metadata_keys_end(). | |
| * | | * | |
| * @param prefix If non-empty, only keys with this prefix are | | * @param prefix If non-empty, only keys with this prefix are | |
| * returned. | | * returned. | |
| * | | * | |
| * @exception Xapian::UnimplementedError will be thrown if the | | * @exception Xapian::UnimplementedError will be thrown if the | |
| * backend implements user-specified metadata,
but | | * backend implements user-specified metadata,
but | |
| * doesn't implement iterating its keys (curren
tly | | * doesn't implement iterating its keys (curren
tly | |
| * this happens for the InMemory backend). | | * this happens for the InMemory backend). | |
| */ | | */ | |
|
| Xapian::TermIterator metadata_keys_begin(const std::string &prefix =
"") const; | | Xapian::TermIterator metadata_keys_begin(const std::string &prefix =
std::string()) const; | |
| | | | |
| /// Corresponding end iterator to metadata_keys_begin(). | | /// Corresponding end iterator to metadata_keys_begin(). | |
|
| Xapian::TermIterator metadata_keys_end(const std::string & = "") con
st { | | Xapian::TermIterator metadata_keys_end(const std::string & = std::st
ring()) const { | |
| return Xapian::TermIterator(NULL); | | return Xapian::TermIterator(NULL); | |
| } | | } | |
|
| | | | |
| | | /** 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 (m | |
| | | ade | |
| | | * with copydatabase, or xapian-compact) will have different UUIDs. | |
| | | * | |
| | | * If the backend does not support UUIDs or this database has no | |
| | | * subdatabases, the UUID will be empty. | |
| | | * | |
| | | * If this database has multiple sub-databases, the UUID string wil | |
| | | l | |
| | | * contain the UUIDs of all the sub-databases. | |
| | | */ | |
| | | std::string get_uuid() const; | |
| }; | | }; | |
| | | | |
| /** This class provides read/write access to a database. | | /** This class provides read/write access to a database. | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT WritableDatabase : public Database { | | class XAPIAN_VISIBILITY_DEFAULT WritableDatabase : public Database { | |
| public: | | public: | |
| /** Destroy this handle on the database. | | /** Destroy this handle on the database. | |
| * | | * | |
| * If there are no copies of this object remaining, the database | | * If there are no copies of this object remaining, the database | |
| * will be closed. If there are any transactions in progress | | * will be closed. If there are any transactions in progress | |
| | | | |
| skipping to change at line 400 | | skipping to change at line 523 | |
| */ | | */ | |
| void operator=(const WritableDatabase &other); | | void operator=(const WritableDatabase &other); | |
| | | | |
| /** Commit any pending modifications made to the database. | | /** Commit any pending modifications made to the database. | |
| * | | * | |
| * For efficiency reasons, when performing multiple updates to a | | * For efficiency reasons, when performing multiple updates to a | |
| * database it is best (indeed, almost essential) to make as many | | * database it is best (indeed, almost essential) to make as many | |
| * modifications as memory will permit in a single pass through | | * modifications as memory will permit in a single pass through | |
| * the database. To ensure this, Xapian batches up modifications. | | * the database. To ensure this, Xapian batches up modifications. | |
| * | | * | |
|
| * Flush may be called at any time to | | * This method may be called at any time to commit any pending | |
| * ensure that the modifications which have been made are written t | | * modifications to the database. | |
| o | | | |
| * disk: if the flush succeeds, all the preceding modifications wil | | | |
| l | | | |
| * have been written to disk. | | | |
| * | | * | |
| * If any of the modifications fail, an exception will be thrown an
d | | * If any of the modifications fail, an exception will be thrown an
d | |
| * the database will be left in a state in which each separate | | * the database will be left in a state in which each separate | |
| * addition, replacement or deletion operation has either been full
y | | * addition, replacement or deletion operation has either been full
y | |
| * performed or not performed at all: it is then up to the | | * performed or not performed at all: it is then up to the | |
| * application to work out which operations need to be repeated. | | * application to work out which operations need to be repeated. | |
| * | | * | |
|
| * It's not valid to call flush() within a transaction. | | * It's not valid to call commit() within a transaction. | |
| * | | * | |
|
| * Beware of calling flush() too frequently: this will make indexin
g | | * Beware of calling commit() too frequently: this will make indexi
ng | |
| * take much longer. | | * take much longer. | |
| * | | * | |
|
| * Note that flush() need not be called explicitly: it will be call
ed | | * Note that commit() need not be called explicitly: it will be cal
led | |
| * automatically when the database is closed, or when a sufficient | | * automatically when the database is closed, or when a sufficient | |
| * number of modifications have been made. By default, this is eve
ry | | * number of modifications have been made. By default, this is eve
ry | |
| * 10000 documents added, deleted, or modified. This value is rath
er | | * 10000 documents added, deleted, or modified. This value is rath
er | |
| * conservative, and if you have a machine with plenty of memory, | | * conservative, and if you have a machine with plenty of memory, | |
| * you can improve indexing throughput dramatically by setting | | * you can improve indexing throughput dramatically by setting | |
| * XAPIAN_FLUSH_THRESHOLD in the environment to a larger value. | | * XAPIAN_FLUSH_THRESHOLD in the environment to a larger value. | |
| * | | * | |
| * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | | * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | |
| * while modifying the database. | | * while modifying the database. | |
| * | | * | |
| * @exception Xapian::DatabaseCorruptError will be thrown if the | | * @exception Xapian::DatabaseCorruptError will be thrown if the | |
| * database is in a corrupt state. | | * database is in a corrupt state. | |
| */ | | */ | |
|
| void flush(); | | void commit(); | |
| | | | |
| | | /** Pre-1.1.0 name for commit(). | |
| | | * | |
| | | * Use commit() instead in new code. This alias may be deprecated | |
| | | in | |
| | | * the future. | |
| | | */ | |
| | | void flush() { commit(); } | |
| | | | |
| /** Begin a transaction. | | /** Begin a transaction. | |
| * | | * | |
| * In Xapian a transaction is a group of modifications to the datab
ase | | * In Xapian a transaction is a group of modifications to the datab
ase | |
| * which are linked such that either all will be applied | | * which are linked such that either all will be applied | |
| * simultaneously or none will be applied at all. Even in the case
of | | * simultaneously or none will be applied at all. Even in the case
of | |
| * a power failure, this characteristic should be preserved (as lon
g | | * a power failure, this characteristic should be preserved (as lon
g | |
| * as the filesystem isn't corrupted, etc). | | * as the filesystem isn't corrupted, etc). | |
| * | | * | |
| * A transaction is started with begin_transaction() and can | | * A transaction is started with begin_transaction() and can | |
| * either be committed by calling commit_transaction() or aborted | | * either be committed by calling commit_transaction() or aborted | |
| * by calling cancel_transaction(). | | * by calling cancel_transaction(). | |
| * | | * | |
|
| * By default, a transaction implicitly calls flush() before and | | * By default, a transaction implicitly calls commit() before and | |
| * after so that the modifications stand and fall without affecting | | * after so that the modifications stand and fall without affecting | |
| * modifications before or after. | | * modifications before or after. | |
| * | | * | |
|
| * The downside of these implicit calls to flush() is that small | | * The downside of these calls to commit() is that small transactio | |
| * transactions can harm indexing performance in the same way that | | ns | |
| * explicitly calling flush() frequently can. | | * can harm indexing performance in the same way that explicitly | |
| | | * calling commit() frequently can. | |
| * | | * | |
| * If you're applying atomic groups of changes and only wish to | | * If you're applying atomic groups of changes and only wish to | |
| * ensure that each group is either applied or not applied, then | | * ensure that each group is either applied or not applied, then | |
|
| * you can prevent the automatic flush before and after the | | * you can prevent the automatic commit() before and after the | |
| * transaction by starting the transaction with | | * transaction by starting the transaction with | |
| * begin_transaction(false). However, if cancel_transaction is | | * begin_transaction(false). However, if cancel_transaction is | |
| * called (or if commit_transaction isn't called before the | | * called (or if commit_transaction isn't called before the | |
| * WritableDatabase object is destroyed) then any changes which | | * WritableDatabase object is destroyed) then any changes which | |
| * were pending before the transaction began will also be discarded
. | | * were pending before the transaction began will also be discarded
. | |
| * | | * | |
| * Transactions aren't currently supported by the InMemory backend. | | * Transactions aren't currently supported by the InMemory backend. | |
| * | | * | |
| * @exception Xapian::UnimplementedError will be thrown if transact
ions | | * @exception Xapian::UnimplementedError will be thrown if transact
ions | |
| * are not available for this database type. | | * are not available for this database type. | |
| | | | |
| skipping to change at line 530 | | skipping to change at line 658 | |
| * | | * | |
| * This method adds the specified document to the database, | | * This method adds the specified document to the database, | |
| * returning a newly allocated document ID. Automatically allocate
d | | * returning a newly allocated document ID. Automatically allocate
d | |
| * document IDs come from a per-database monotonically increasing | | * document IDs come from a per-database monotonically increasing | |
| * counter, so IDs from deleted documents won't be reused. | | * counter, so IDs from deleted documents won't be reused. | |
| * | | * | |
| * If you want to specify the document ID to be used, you should | | * If you want to specify the document ID to be used, you should | |
| * call replace_document() instead. | | * call replace_document() instead. | |
| * | | * | |
| * Note that changes to the database won't be immediately committed
to | | * Note that changes to the database won't be immediately committed
to | |
|
| * disk; see flush() for more details. | | * disk; see commit() for more details. | |
| * | | * | |
| * As with all database modification operations, the effect is | | * As with all database modification operations, the effect is | |
| * atomic: the document will either be fully added, or the document | | * atomic: the document will either be fully added, or the document | |
| * fails to be added and an exception is thrown (possibly at a | | * fails to be added and an exception is thrown (possibly at a | |
|
| * later time when flush() is called or the database is closed). | | * later time when commit() is called or the database is closed). | |
| * | | * | |
| * @param document The new document to be added. | | * @param document The new document to be added. | |
| * | | * | |
| * @return The document ID of the newly added document. | | * @return The document ID of the newly added document. | |
| * | | * | |
| * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | | * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | |
| * while writing to the database. | | * while writing to the database. | |
| * | | * | |
| * @exception Xapian::DatabaseCorruptError will be thrown if the | | * @exception Xapian::DatabaseCorruptError will be thrown if the | |
| * database is in a corrupt state. | | * database is in a corrupt state. | |
| */ | | */ | |
| Xapian::docid add_document(const Xapian::Document & document); | | Xapian::docid add_document(const Xapian::Document & document); | |
| | | | |
| /** Delete a document from the database. | | /** Delete a document from the database. | |
| * | | * | |
| * This method removes the document with the specified document ID | | * This method removes the document with the specified document ID | |
| * from the database. | | * from the database. | |
| * | | * | |
| * Note that changes to the database won't be immediately committed
to | | * Note that changes to the database won't be immediately committed
to | |
|
| * disk; see flush() for more details. | | * disk; see commit() for more details. | |
| * | | * | |
| * As with all database modification operations, the effect is | | * As with all database modification operations, the effect is | |
| * atomic: the document will either be fully removed, or the docume
nt | | * atomic: the document will either be fully removed, or the docume
nt | |
| * fails to be removed and an exception is thrown (possibly at a | | * fails to be removed and an exception is thrown (possibly at a | |
|
| * later time when flush() is called or the database is closed). | | * later time when commit() is called or the database is closed). | |
| * | | * | |
| * @param did The document ID of the document to be removed. | | * @param did The document ID of the document to be removed. | |
| * | | * | |
| * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | | * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | |
| * while writing to the database. | | * while writing to the database. | |
| * | | * | |
| * @exception Xapian::DatabaseCorruptError will be thrown if the | | * @exception Xapian::DatabaseCorruptError will be thrown if the | |
| * database is in a corrupt state. | | * database is in a corrupt state. | |
| */ | | */ | |
| void delete_document(Xapian::docid did); | | void delete_document(Xapian::docid did); | |
| | | | |
| skipping to change at line 608 | | skipping to change at line 736 | |
| * | | * | |
| * The monotonic counter used for automatically allocating document | | * The monotonic counter used for automatically allocating document | |
| * IDs is increased so that the next automatically allocated docume
nt | | * IDs is increased so that the next automatically allocated docume
nt | |
| * ID will be did + 1. Be aware that if you use this method to | | * ID will be did + 1. Be aware that if you use this method to | |
| * specify a high document ID for a new document, and also use | | * specify a high document ID for a new document, and also use | |
| * WritableDatabase::add_document(), Xapian may get to a state wher
e | | * WritableDatabase::add_document(), Xapian may get to a state wher
e | |
| * this counter wraps around and will be unable to automatically | | * this counter wraps around and will be unable to automatically | |
| * allocate document IDs! | | * allocate document IDs! | |
| * | | * | |
| * Note that changes to the database won't be immediately committed
to | | * Note that changes to the database won't be immediately committed
to | |
|
| * disk; see flush() for more details. | | * disk; see commit() for more details. | |
| * | | * | |
| * As with all database modification operations, the effect is | | * As with all database modification operations, the effect is | |
| * atomic: the document will either be fully replaced, or the docum
ent | | * atomic: the document will either be fully replaced, or the docum
ent | |
| * fails to be replaced and an exception is thrown (possibly at a | | * fails to be replaced and an exception is thrown (possibly at a | |
|
| * later time when flush() is called or the database is closed). | | * later time when commit() is called or the database is closed). | |
| * | | * | |
| * @param did The document ID of the document to be replaced. | | * @param did The document ID of the document to be replaced. | |
| * @param document The new document. | | * @param document The new document. | |
| * | | * | |
| * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | | * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | |
| * while writing to the database. | | * while writing to the database. | |
| * | | * | |
| * @exception Xapian::DatabaseCorruptError will be thrown if the | | * @exception Xapian::DatabaseCorruptError will be thrown if the | |
| * database is in a corrupt state. | | * database is in a corrupt state. | |
| */ | | */ | |
| void replace_document(Xapian::docid did, | | void replace_document(Xapian::docid did, | |
| const Xapian::Document & document); | | const Xapian::Document & document); | |
| | | | |
| /** Replace any documents matching a term. | | /** Replace any documents matching a term. | |
| * | | * | |
| * This method replaces any documents indexed by the specified term | | * This method replaces any documents indexed by the specified term | |
| * with the specified document. If any documents are indexed by th
e | | * with the specified document. If any documents are indexed by th
e | |
| * term, the lowest document ID will be used for the document, | | * term, the lowest document ID will be used for the document, | |
| * otherwise a new document ID will be generated as for add_documen
t. | | * otherwise a new document ID will be generated as for add_documen
t. | |
| * | | * | |
|
| * One common use is to allow UIDs from another system to easily be | | * The intended use is to allow UIDs from another system to easily | |
| * mapped to terms in Xapian. Note that this method doesn't | | * be mapped to terms in Xapian, although this method probably has | |
| * automatically add unique_term as a term, so you'll need to call | | * other uses. | |
| * document.add_term(unique_term) first when using replace_document | | | |
| () | | | |
| * in this way. | | | |
| * | | | |
| * Another possible use is to allow groups of documents to be marke | | | |
| d for | | | |
| * later deletion - for example, you could add a "deletion date" te | | | |
| rm | | | |
| * to documents at index time and use this method to easily and eff | | | |
| iciently | | | |
| * delete all documents due for deletion on a particular date. | | | |
| * | | * | |
| * Note that changes to the database won't be immediately committed
to | | * Note that changes to the database won't be immediately committed
to | |
|
| * disk; see flush() for more details. | | * disk; see commit() for more details. | |
| * | | * | |
| * As with all database modification operations, the effect is | | * As with all database modification operations, the effect is | |
| * atomic: the document(s) will either be fully replaced, or the | | * atomic: the document(s) will either be fully replaced, or the | |
| * document(s) fail to be replaced and an exception is thrown | | * document(s) fail to be replaced and an exception is thrown | |
| * (possibly at a | | * (possibly at a | |
|
| * later time when flush() is called or the database is closed). | | * later time when commit() is called or the database is closed). | |
| * | | * | |
| * @param unique_term The "unique" term. | | * @param unique_term The "unique" term. | |
| * @param document The new document. | | * @param document The new document. | |
| * | | * | |
| * @return The document ID that document was given. | | * @return The document ID that document was given. | |
| * | | * | |
| * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | | * @exception Xapian::DatabaseError will be thrown if a problem occ
urs | |
| * while writing to the database. | | * while writing to the database. | |
| * | | * | |
| * @exception Xapian::DatabaseCorruptError will be thrown if the | | * @exception Xapian::DatabaseCorruptError will be thrown if the | |
| | | | |
| skipping to change at line 729 | | skipping to change at line 850 | |
| * | | * | |
| * There's no hard limit on the number of metadata items, or the si
ze | | * There's no hard limit on the number of metadata items, or the si
ze | |
| * of the metadata values. Metadata keys have a limited length, wh
ich | | * of the metadata values. Metadata keys have a limited length, wh
ich | |
| * depends on the backend. We recommend limiting them to 200 bytes
. | | * depends on the backend. We recommend limiting them to 200 bytes
. | |
| * Empty keys are not valid, and specifying one will cause an | | * Empty keys are not valid, and specifying one will cause an | |
| * exception. | | * exception. | |
| * | | * | |
| * Metadata modifications are committed to disk in the same way as | | * Metadata modifications are committed to disk in the same way as | |
| * modifications to the documents in the database are: i.e., | | * modifications to the documents in the database are: i.e., | |
| * modifications are atomic, and won't be committed to disk | | * modifications are atomic, and won't be committed to disk | |
|
| * immediately (see flush() for more details). This allows metadat
a | | * immediately (see commit() for more details). This allows metada
ta | |
| * to be used to link databases with versioned external resources | | * to be used to link databases with versioned external resources | |
| * by storing the appropriate version number in a metadata item. | | * by storing the appropriate version number in a metadata item. | |
| * | | * | |
| * You can also use the metadata to store arbitrary extra informati
on | | * You can also use the metadata to store arbitrary extra informati
on | |
| * associated with terms, documents, or postings by encoding the | | * associated with terms, documents, or postings by encoding the | |
| * termname and/or document id into the metadata key. | | * termname and/or document id into the metadata key. | |
| * | | * | |
| * @param key The key of the metadata item to set. | | * @param key The key of the metadata item to set. | |
| * | | * | |
| * @param value The value of the metadata item to set. | | * @param value The value of the metadata item to set. | |
| | | | |
End of changes. 35 change blocks. |
| 51 lines changed or deleted | | 186 lines changed or added | |
|
| error.h | | error.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * | | * | |
| * You should have received a copy of the GNU General Public License | | * You should have received a copy of the GNU General Public License | |
| * along with this program; if not, write to the Free Software | | * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
A | | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
A | |
| */ | | */ | |
| | | | |
| #ifndef XAPIAN_INCLUDED_ERROR_H | | #ifndef XAPIAN_INCLUDED_ERROR_H | |
| #define XAPIAN_INCLUDED_ERROR_H | | #define XAPIAN_INCLUDED_ERROR_H | |
| | | | |
| #include <string> | | #include <string> | |
|
| #include <xapian/deprecated.h> | | | |
| #include <xapian/visibility.h> | | #include <xapian/visibility.h> | |
| | | | |
| namespace Xapian { | | namespace Xapian { | |
| | | | |
| class ErrorHandler; | | class ErrorHandler; | |
| | | | |
| /** All exceptions thrown by Xapian are subclasses of Xapian::Error. | | /** All exceptions thrown by Xapian are subclasses of Xapian::Error. | |
| * | | * | |
| * This class can not be instantiated directly - instead a subclass should | | * This class can not be instantiated directly - instead a subclass should | |
| * be used. | | * be used. | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 122 | |
| const std::string & get_context() const { return context; } | | const std::string & get_context() const { return context; } | |
| | | | |
| /** Returns any system error string associated with this exception. | | /** Returns any system error string associated with this exception. | |
| * | | * | |
| * The system error string may come from errno, h_errno (on UNIX), or | | * The system error string may come from errno, h_errno (on UNIX), or | |
| * GetLastError() (on MS Windows). If there is no associated system | | * GetLastError() (on MS Windows). If there is no associated system | |
| * error string, NULL is returned. | | * error string, NULL is returned. | |
| */ | | */ | |
| const char * get_error_string() const; | | const char * get_error_string() const; | |
| | | | |
|
| /** Optional value of 'errno' associated with this error. | | | |
| * | | | |
| * If no 'errno' value is associated, returns 0. If the returned valu | | | |
| e | | | |
| * is negative, it's a platform-specific error code (on UNIX, -h_errno | | | |
| ; | | | |
| * on MS Windows, -GetLastError()). | | | |
| * | | | |
| * @deprecated This method is deprecated, because errno values aren't | | | |
| * portable between platforms, so we can't serialise them when passing | | | |
| * exceptions from a remote server to a client. Use the | | | |
| * get_error_string() method instead. | | | |
| */ | | | |
| XAPIAN_DEPRECATED(int get_errno() const); | | | |
| | | | |
| /// Return a string describing this object. | | /// Return a string describing this object. | |
| std::string get_description() const; | | std::string get_description() const; | |
| }; | | }; | |
| | | | |
|
| inline int Xapian::Error::get_errno() const { return my_errno; } | | | |
| | | | |
| /** The base class for exceptions indicating errors in the program logic. | | /** The base class for exceptions indicating errors in the program logic. | |
| * | | * | |
| * A subclass of LogicError will be thrown if Xapian detects a violation | | * A subclass of LogicError will be thrown if Xapian detects a violation | |
| * of a class invariant or a logical precondition or postcondition, etc. | | * of a class invariant or a logical precondition or postcondition, etc. | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT LogicError : public Error { | | class XAPIAN_VISIBILITY_DEFAULT LogicError : public Error { | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 202 | | skipping to change at line 186 | |
| class XAPIAN_VISIBILITY_DEFAULT AssertionError : public LogicError { | | class XAPIAN_VISIBILITY_DEFAULT AssertionError : public LogicError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| AssertionError(const std::string &msg_, const std::string &context_, co
nst char * error_string_) | | AssertionError(const std::string &msg_, const std::string &context_, co
nst char * error_string_) | |
| : LogicError(msg_, context_, "AssertionError", error_string_) {} | | : LogicError(msg_, context_, "AssertionError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit AssertionError(const std::string &msg_, const std::string &con
text_ = "", int errno_ = 0) | | explicit AssertionError(const std::string &msg_, const std::string &con
text_ = std::string(), int errno_ = 0) | |
| : LogicError(msg_, context_, "AssertionError", errno_) {} | | : LogicError(msg_, context_, "AssertionError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| AssertionError(const std::string &msg_, int errno_) | | AssertionError(const std::string &msg_, int errno_) | |
|
| : LogicError(msg_, "", "AssertionError", errno_) {} | | : LogicError(msg_, std::string(), "AssertionError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| AssertionError(const std::string &msg_, const std::string &context_, co
nst char * type_, const char * error_string_) | | AssertionError(const std::string &msg_, const std::string &context_, co
nst char * type_, const char * error_string_) | |
| : LogicError(msg_, context_, type_, error_string_) {} | | : LogicError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 233 | | skipping to change at line 217 | |
| class XAPIAN_VISIBILITY_DEFAULT InvalidArgumentError : public LogicError { | | class XAPIAN_VISIBILITY_DEFAULT InvalidArgumentError : public LogicError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| InvalidArgumentError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | | InvalidArgumentError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | |
| : LogicError(msg_, context_, "InvalidArgumentError", error_string_)
{} | | : LogicError(msg_, context_, "InvalidArgumentError", error_string_)
{} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit InvalidArgumentError(const std::string &msg_, const std::strin
g &context_ = "", int errno_ = 0) | | explicit InvalidArgumentError(const std::string &msg_, const std::strin
g &context_ = std::string(), int errno_ = 0) | |
| : LogicError(msg_, context_, "InvalidArgumentError", errno_) {} | | : LogicError(msg_, context_, "InvalidArgumentError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| InvalidArgumentError(const std::string &msg_, int errno_) | | InvalidArgumentError(const std::string &msg_, int errno_) | |
|
| : LogicError(msg_, "", "InvalidArgumentError", errno_) {} | | : LogicError(msg_, std::string(), "InvalidArgumentError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| InvalidArgumentError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | | InvalidArgumentError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | |
| : LogicError(msg_, context_, type_, error_string_) {} | | : LogicError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 264 | | skipping to change at line 248 | |
| class XAPIAN_VISIBILITY_DEFAULT InvalidOperationError : public LogicError { | | class XAPIAN_VISIBILITY_DEFAULT InvalidOperationError : public LogicError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| InvalidOperationError(const std::string &msg_, const std::string &conte
xt_, const char * error_string_) | | InvalidOperationError(const std::string &msg_, const std::string &conte
xt_, const char * error_string_) | |
| : LogicError(msg_, context_, "InvalidOperationError", error_string_)
{} | | : LogicError(msg_, context_, "InvalidOperationError", error_string_)
{} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit InvalidOperationError(const std::string &msg_, const std::stri
ng &context_ = "", int errno_ = 0) | | explicit InvalidOperationError(const std::string &msg_, const std::stri
ng &context_ = std::string(), int errno_ = 0) | |
| : LogicError(msg_, context_, "InvalidOperationError", errno_) {} | | : LogicError(msg_, context_, "InvalidOperationError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| InvalidOperationError(const std::string &msg_, int errno_) | | InvalidOperationError(const std::string &msg_, int errno_) | |
|
| : LogicError(msg_, "", "InvalidOperationError", errno_) {} | | : LogicError(msg_, std::string(), "InvalidOperationError", errno_) {
} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| InvalidOperationError(const std::string &msg_, const std::string &conte
xt_, const char * type_, const char * error_string_) | | InvalidOperationError(const std::string &msg_, const std::string &conte
xt_, const char * type_, const char * error_string_) | |
| : LogicError(msg_, context_, type_, error_string_) {} | | : LogicError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 294 | | skipping to change at line 278 | |
| class XAPIAN_VISIBILITY_DEFAULT UnimplementedError : public LogicError { | | class XAPIAN_VISIBILITY_DEFAULT UnimplementedError : public LogicError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| UnimplementedError(const std::string &msg_, const std::string &context_
, const char * error_string_) | | UnimplementedError(const std::string &msg_, const std::string &context_
, const char * error_string_) | |
| : LogicError(msg_, context_, "UnimplementedError", error_string_) {} | | : LogicError(msg_, context_, "UnimplementedError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit UnimplementedError(const std::string &msg_, const std::string
&context_ = "", int errno_ = 0) | | explicit UnimplementedError(const std::string &msg_, const std::string
&context_ = std::string(), int errno_ = 0) | |
| : LogicError(msg_, context_, "UnimplementedError", errno_) {} | | : LogicError(msg_, context_, "UnimplementedError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| UnimplementedError(const std::string &msg_, int errno_) | | UnimplementedError(const std::string &msg_, int errno_) | |
|
| : LogicError(msg_, "", "UnimplementedError", errno_) {} | | : LogicError(msg_, std::string(), "UnimplementedError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| UnimplementedError(const std::string &msg_, const std::string &context_
, const char * type_, const char * error_string_) | | UnimplementedError(const std::string &msg_, const std::string &context_
, const char * type_, const char * error_string_) | |
| : LogicError(msg_, context_, type_, error_string_) {} | | : LogicError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 324 | | skipping to change at line 308 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseError : public RuntimeError { | | class XAPIAN_VISIBILITY_DEFAULT DatabaseError : public RuntimeError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseError(const std::string &msg_, const std::string &context_, con
st char * error_string_) | | DatabaseError(const std::string &msg_, const std::string &context_, con
st char * error_string_) | |
| : RuntimeError(msg_, context_, "DatabaseError", error_string_) {} | | : RuntimeError(msg_, context_, "DatabaseError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseError(const std::string &msg_, const std::string &cont
ext_ = "", int errno_ = 0) | | explicit DatabaseError(const std::string &msg_, const std::string &cont
ext_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "DatabaseError", errno_) {} | | : RuntimeError(msg_, context_, "DatabaseError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseError(const std::string &msg_, int errno_) | | DatabaseError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "DatabaseError", errno_) {} | | : RuntimeError(msg_, std::string(), "DatabaseError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseError(const std::string &msg_, const std::string &context_, con
st char * type_, const char * error_string_) | | DatabaseError(const std::string &msg_, const std::string &context_, con
st char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 354 | | skipping to change at line 338 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseCorruptError : public DatabaseError
{ | | class XAPIAN_VISIBILITY_DEFAULT DatabaseCorruptError : public DatabaseError
{ | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseCorruptError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | | DatabaseCorruptError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | |
| : DatabaseError(msg_, context_, "DatabaseCorruptError", error_string
_) {} | | : DatabaseError(msg_, context_, "DatabaseCorruptError", error_string
_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseCorruptError(const std::string &msg_, const std::strin
g &context_ = "", int errno_ = 0) | | explicit DatabaseCorruptError(const std::string &msg_, const std::strin
g &context_ = std::string(), int errno_ = 0) | |
| : DatabaseError(msg_, context_, "DatabaseCorruptError", errno_) {} | | : DatabaseError(msg_, context_, "DatabaseCorruptError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseCorruptError(const std::string &msg_, int errno_) | | DatabaseCorruptError(const std::string &msg_, int errno_) | |
|
| : DatabaseError(msg_, "", "DatabaseCorruptError", errno_) {} | | : DatabaseError(msg_, std::string(), "DatabaseCorruptError", errno_)
{} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseCorruptError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | | DatabaseCorruptError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | |
| : DatabaseError(msg_, context_, type_, error_string_) {} | | : DatabaseError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 384 | | skipping to change at line 368 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseCreateError : public DatabaseError
{ | | class XAPIAN_VISIBILITY_DEFAULT DatabaseCreateError : public DatabaseError
{ | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseCreateError(const std::string &msg_, const std::string &context
_, const char * error_string_) | | DatabaseCreateError(const std::string &msg_, const std::string &context
_, const char * error_string_) | |
| : DatabaseError(msg_, context_, "DatabaseCreateError", error_string_
) {} | | : DatabaseError(msg_, context_, "DatabaseCreateError", error_string_
) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseCreateError(const std::string &msg_, const std::string
&context_ = "", int errno_ = 0) | | explicit DatabaseCreateError(const std::string &msg_, const std::string
&context_ = std::string(), int errno_ = 0) | |
| : DatabaseError(msg_, context_, "DatabaseCreateError", errno_) {} | | : DatabaseError(msg_, context_, "DatabaseCreateError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseCreateError(const std::string &msg_, int errno_) | | DatabaseCreateError(const std::string &msg_, int errno_) | |
|
| : DatabaseError(msg_, "", "DatabaseCreateError", errno_) {} | | : DatabaseError(msg_, std::string(), "DatabaseCreateError", errno_)
{} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseCreateError(const std::string &msg_, const std::string &context
_, const char * type_, const char * error_string_) | | DatabaseCreateError(const std::string &msg_, const std::string &context
_, const char * type_, const char * error_string_) | |
| : DatabaseError(msg_, context_, type_, error_string_) {} | | : DatabaseError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 414 | | skipping to change at line 398 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseLockError : public DatabaseError { | | class XAPIAN_VISIBILITY_DEFAULT DatabaseLockError : public DatabaseError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseLockError(const std::string &msg_, const std::string &context_,
const char * error_string_) | | DatabaseLockError(const std::string &msg_, const std::string &context_,
const char * error_string_) | |
| : DatabaseError(msg_, context_, "DatabaseLockError", error_string_)
{} | | : DatabaseError(msg_, context_, "DatabaseLockError", error_string_)
{} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseLockError(const std::string &msg_, const std::string &
context_ = "", int errno_ = 0) | | explicit DatabaseLockError(const std::string &msg_, const std::string &
context_ = std::string(), int errno_ = 0) | |
| : DatabaseError(msg_, context_, "DatabaseLockError", errno_) {} | | : DatabaseError(msg_, context_, "DatabaseLockError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseLockError(const std::string &msg_, int errno_) | | DatabaseLockError(const std::string &msg_, int errno_) | |
|
| : DatabaseError(msg_, "", "DatabaseLockError", errno_) {} | | : DatabaseError(msg_, std::string(), "DatabaseLockError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseLockError(const std::string &msg_, const std::string &context_,
const char * type_, const char * error_string_) | | DatabaseLockError(const std::string &msg_, const std::string &context_,
const char * type_, const char * error_string_) | |
| : DatabaseError(msg_, context_, type_, error_string_) {} | | : DatabaseError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 449 | | skipping to change at line 433 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseModifiedError : public DatabaseErro
r { | | class XAPIAN_VISIBILITY_DEFAULT DatabaseModifiedError : public DatabaseErro
r { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseModifiedError(const std::string &msg_, const std::string &conte
xt_, const char * error_string_) | | DatabaseModifiedError(const std::string &msg_, const std::string &conte
xt_, const char * error_string_) | |
| : DatabaseError(msg_, context_, "DatabaseModifiedError", error_strin
g_) {} | | : DatabaseError(msg_, context_, "DatabaseModifiedError", error_strin
g_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseModifiedError(const std::string &msg_, const std::stri
ng &context_ = "", int errno_ = 0) | | explicit DatabaseModifiedError(const std::string &msg_, const std::stri
ng &context_ = std::string(), int errno_ = 0) | |
| : DatabaseError(msg_, context_, "DatabaseModifiedError", errno_) {} | | : DatabaseError(msg_, context_, "DatabaseModifiedError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseModifiedError(const std::string &msg_, int errno_) | | DatabaseModifiedError(const std::string &msg_, int errno_) | |
|
| : DatabaseError(msg_, "", "DatabaseModifiedError", errno_) {} | | : DatabaseError(msg_, std::string(), "DatabaseModifiedError", errno_
) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseModifiedError(const std::string &msg_, const std::string &conte
xt_, const char * type_, const char * error_string_) | | DatabaseModifiedError(const std::string &msg_, const std::string &conte
xt_, const char * type_, const char * error_string_) | |
| : DatabaseError(msg_, context_, type_, error_string_) {} | | : DatabaseError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 479 | | skipping to change at line 463 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseOpeningError : public DatabaseError
{ | | class XAPIAN_VISIBILITY_DEFAULT DatabaseOpeningError : public DatabaseError
{ | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseOpeningError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | | DatabaseOpeningError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | |
| : DatabaseError(msg_, context_, "DatabaseOpeningError", error_string
_) {} | | : DatabaseError(msg_, context_, "DatabaseOpeningError", error_string
_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseOpeningError(const std::string &msg_, const std::strin
g &context_ = "", int errno_ = 0) | | explicit DatabaseOpeningError(const std::string &msg_, const std::strin
g &context_ = std::string(), int errno_ = 0) | |
| : DatabaseError(msg_, context_, "DatabaseOpeningError", errno_) {} | | : DatabaseError(msg_, context_, "DatabaseOpeningError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseOpeningError(const std::string &msg_, int errno_) | | DatabaseOpeningError(const std::string &msg_, int errno_) | |
|
| : DatabaseError(msg_, "", "DatabaseOpeningError", errno_) {} | | : DatabaseError(msg_, std::string(), "DatabaseOpeningError", errno_)
{} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseOpeningError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | | DatabaseOpeningError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | |
| : DatabaseError(msg_, context_, type_, error_string_) {} | | : DatabaseError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 519 | | skipping to change at line 503 | |
| class XAPIAN_VISIBILITY_DEFAULT DatabaseVersionError : public DatabaseOpeni
ngError { | | class XAPIAN_VISIBILITY_DEFAULT DatabaseVersionError : public DatabaseOpeni
ngError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DatabaseVersionError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | | DatabaseVersionError(const std::string &msg_, const std::string &contex
t_, const char * error_string_) | |
| : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", error
_string_) {} | | : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", error
_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DatabaseVersionError(const std::string &msg_, const std::strin
g &context_ = "", int errno_ = 0) | | explicit DatabaseVersionError(const std::string &msg_, const std::strin
g &context_ = std::string(), int errno_ = 0) | |
| : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", errno
_) {} | | : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", errno
_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DatabaseVersionError(const std::string &msg_, int errno_) | | DatabaseVersionError(const std::string &msg_, int errno_) | |
|
| : DatabaseOpeningError(msg_, "", "DatabaseVersionError", errno_) {} | | : DatabaseOpeningError(msg_, std::string(), "DatabaseVersionError",
errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DatabaseVersionError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | | DatabaseVersionError(const std::string &msg_, const std::string &contex
t_, const char * type_, const char * error_string_) | |
| : DatabaseOpeningError(msg_, context_, type_, error_string_) {} | | : DatabaseOpeningError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 549 | | skipping to change at line 533 | |
| class XAPIAN_VISIBILITY_DEFAULT DocNotFoundError : public RuntimeError { | | class XAPIAN_VISIBILITY_DEFAULT DocNotFoundError : public RuntimeError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| DocNotFoundError(const std::string &msg_, const std::string &context_,
const char * error_string_) | | DocNotFoundError(const std::string &msg_, const std::string &context_,
const char * error_string_) | |
| : RuntimeError(msg_, context_, "DocNotFoundError", error_string_) {} | | : RuntimeError(msg_, context_, "DocNotFoundError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit DocNotFoundError(const std::string &msg_, const std::string &c
ontext_ = "", int errno_ = 0) | | explicit DocNotFoundError(const std::string &msg_, const std::string &c
ontext_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "DocNotFoundError", errno_) {} | | : RuntimeError(msg_, context_, "DocNotFoundError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| DocNotFoundError(const std::string &msg_, int errno_) | | DocNotFoundError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "DocNotFoundError", errno_) {} | | : RuntimeError(msg_, std::string(), "DocNotFoundError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| DocNotFoundError(const std::string &msg_, const std::string &context_,
const char * type_, const char * error_string_) | | DocNotFoundError(const std::string &msg_, const std::string &context_,
const char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 583 | | skipping to change at line 567 | |
| class XAPIAN_VISIBILITY_DEFAULT FeatureUnavailableError : public RuntimeErr
or { | | class XAPIAN_VISIBILITY_DEFAULT FeatureUnavailableError : public RuntimeErr
or { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| FeatureUnavailableError(const std::string &msg_, const std::string &con
text_, const char * error_string_) | | FeatureUnavailableError(const std::string &msg_, const std::string &con
text_, const char * error_string_) | |
| : RuntimeError(msg_, context_, "FeatureUnavailableError", error_stri
ng_) {} | | : RuntimeError(msg_, context_, "FeatureUnavailableError", error_stri
ng_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit FeatureUnavailableError(const std::string &msg_, const std::st
ring &context_ = "", int errno_ = 0) | | explicit FeatureUnavailableError(const std::string &msg_, const std::st
ring &context_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "FeatureUnavailableError", errno_) {} | | : RuntimeError(msg_, context_, "FeatureUnavailableError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| FeatureUnavailableError(const std::string &msg_, int errno_) | | FeatureUnavailableError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "FeatureUnavailableError", errno_) {} | | : RuntimeError(msg_, std::string(), "FeatureUnavailableError", errno
_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| FeatureUnavailableError(const std::string &msg_, const std::string &con
text_, const char * type_, const char * error_string_) | | FeatureUnavailableError(const std::string &msg_, const std::string &con
text_, const char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 613 | | skipping to change at line 597 | |
| class XAPIAN_VISIBILITY_DEFAULT InternalError : public RuntimeError { | | class XAPIAN_VISIBILITY_DEFAULT InternalError : public RuntimeError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| InternalError(const std::string &msg_, const std::string &context_, con
st char * error_string_) | | InternalError(const std::string &msg_, const std::string &context_, con
st char * error_string_) | |
| : RuntimeError(msg_, context_, "InternalError", error_string_) {} | | : RuntimeError(msg_, context_, "InternalError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit InternalError(const std::string &msg_, const std::string &cont
ext_ = "", int errno_ = 0) | | explicit InternalError(const std::string &msg_, const std::string &cont
ext_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "InternalError", errno_) {} | | : RuntimeError(msg_, context_, "InternalError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| InternalError(const std::string &msg_, int errno_) | | InternalError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "InternalError", errno_) {} | | : RuntimeError(msg_, std::string(), "InternalError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| InternalError(const std::string &msg_, const std::string &context_, con
st char * type_, const char * error_string_) | | InternalError(const std::string &msg_, const std::string &context_, con
st char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 643 | | skipping to change at line 627 | |
| class XAPIAN_VISIBILITY_DEFAULT NetworkError : public RuntimeError { | | class XAPIAN_VISIBILITY_DEFAULT NetworkError : public RuntimeError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| NetworkError(const std::string &msg_, const std::string &context_, cons
t char * error_string_) | | NetworkError(const std::string &msg_, const std::string &context_, cons
t char * error_string_) | |
| : RuntimeError(msg_, context_, "NetworkError", error_string_) {} | | : RuntimeError(msg_, context_, "NetworkError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit NetworkError(const std::string &msg_, const std::string &conte
xt_ = "", int errno_ = 0) | | explicit NetworkError(const std::string &msg_, const std::string &conte
xt_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "NetworkError", errno_) {} | | : RuntimeError(msg_, context_, "NetworkError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| NetworkError(const std::string &msg_, int errno_) | | NetworkError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "NetworkError", errno_) {} | | : RuntimeError(msg_, std::string(), "NetworkError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| NetworkError(const std::string &msg_, const std::string &context_, cons
t char * type_, const char * error_string_) | | NetworkError(const std::string &msg_, const std::string &context_, cons
t char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 673 | | skipping to change at line 657 | |
| class XAPIAN_VISIBILITY_DEFAULT NetworkTimeoutError : public NetworkError { | | class XAPIAN_VISIBILITY_DEFAULT NetworkTimeoutError : public NetworkError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| NetworkTimeoutError(const std::string &msg_, const std::string &context
_, const char * error_string_) | | NetworkTimeoutError(const std::string &msg_, const std::string &context
_, const char * error_string_) | |
| : NetworkError(msg_, context_, "NetworkTimeoutError", error_string_)
{} | | : NetworkError(msg_, context_, "NetworkTimeoutError", error_string_)
{} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit NetworkTimeoutError(const std::string &msg_, const std::string
&context_ = "", int errno_ = 0) | | explicit NetworkTimeoutError(const std::string &msg_, const std::string
&context_ = std::string(), int errno_ = 0) | |
| : NetworkError(msg_, context_, "NetworkTimeoutError", errno_) {} | | : NetworkError(msg_, context_, "NetworkTimeoutError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| NetworkTimeoutError(const std::string &msg_, int errno_) | | NetworkTimeoutError(const std::string &msg_, int errno_) | |
|
| : NetworkError(msg_, "", "NetworkTimeoutError", errno_) {} | | : NetworkError(msg_, std::string(), "NetworkTimeoutError", errno_) {
} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| NetworkTimeoutError(const std::string &msg_, const std::string &context
_, const char * type_, const char * error_string_) | | NetworkTimeoutError(const std::string &msg_, const std::string &context
_, const char * type_, const char * error_string_) | |
| : NetworkError(msg_, context_, type_, error_string_) {} | | : NetworkError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 703 | | skipping to change at line 687 | |
| class XAPIAN_VISIBILITY_DEFAULT QueryParserError : public RuntimeError { | | class XAPIAN_VISIBILITY_DEFAULT QueryParserError : public RuntimeError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| QueryParserError(const std::string &msg_, const std::string &context_,
const char * error_string_) | | QueryParserError(const std::string &msg_, const std::string &context_,
const char * error_string_) | |
| : RuntimeError(msg_, context_, "QueryParserError", error_string_) {} | | : RuntimeError(msg_, context_, "QueryParserError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit QueryParserError(const std::string &msg_, const std::string &c
ontext_ = "", int errno_ = 0) | | explicit QueryParserError(const std::string &msg_, const std::string &c
ontext_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "QueryParserError", errno_) {} | | : RuntimeError(msg_, context_, "QueryParserError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| QueryParserError(const std::string &msg_, int errno_) | | QueryParserError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "QueryParserError", errno_) {} | | : RuntimeError(msg_, std::string(), "QueryParserError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| QueryParserError(const std::string &msg_, const std::string &context_,
const char * type_, const char * error_string_) | | QueryParserError(const std::string &msg_, const std::string &context_,
const char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
| skipping to change at line 734 | | skipping to change at line 718 | |
| class XAPIAN_VISIBILITY_DEFAULT RangeError : public RuntimeError { | | class XAPIAN_VISIBILITY_DEFAULT RangeError : public RuntimeError { | |
| public: | | public: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Private constructor for use by remote backend. | | * @brief Private constructor for use by remote backend. | |
| * | | * | |
| * @param error_string_ Optional string describing error. May be NU
LL. | | * @param error_string_ Optional string describing error. May be NU
LL. | |
| */ | | */ | |
| RangeError(const std::string &msg_, const std::string &context_, const
char * error_string_) | | RangeError(const std::string &msg_, const std::string &context_, const
char * error_string_) | |
| : RuntimeError(msg_, context_, "RangeError", error_string_) {} | | : RuntimeError(msg_, context_, "RangeError", error_string_) {} | |
| /** General purpose constructor which allows setting errno. */ | | /** General purpose constructor which allows setting errno. */ | |
|
| explicit RangeError(const std::string &msg_, const std::string &context
_ = "", int errno_ = 0) | | explicit RangeError(const std::string &msg_, const std::string &context
_ = std::string(), int errno_ = 0) | |
| : RuntimeError(msg_, context_, "RangeError", errno_) {} | | : RuntimeError(msg_, context_, "RangeError", errno_) {} | |
| /** Construct from message and errno value. */ | | /** Construct from message and errno value. */ | |
| RangeError(const std::string &msg_, int errno_) | | RangeError(const std::string &msg_, int errno_) | |
|
| : RuntimeError(msg_, "", "RangeError", errno_) {} | | : RuntimeError(msg_, std::string(), "RangeError", errno_) {} | |
| protected: | | protected: | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| RangeError(const std::string &msg_, const std::string &context_, const
char * type_, const char * error_string_) | | RangeError(const std::string &msg_, const std::string &context_, const
char * type_, const char * error_string_) | |
| : RuntimeError(msg_, context_, type_, error_string_) {} | | : RuntimeError(msg_, context_, type_, error_string_) {} | |
| | | | |
| /** @private @internal | | /** @private @internal | |
| * @brief Constructor for use by constructors of derived classes. | | * @brief Constructor for use by constructors of derived classes. | |
| */ | | */ | |
| | | | |
End of changes. 39 change blocks. |
| 54 lines changed or deleted | | 36 lines changed or added | |
|
| queryparser.h | | queryparser.h | |
| /** \file queryparser.h | | /** \file queryparser.h | |
| * \brief parsing a user query string to build a Xapian::Query object | | * \brief parsing a user query string to build a Xapian::Query object | |
| */ | | */ | |
|
| /* Copyright (C) 2005,2006,2007,2008,2009,2010 Olly Betts | | /* Copyright (C) 2005,2006,2007,2008,2009 Olly Betts | |
| * | | * | |
| * This program is free software; you can redistribute it and/or | | * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | | * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #include <xapian/base.h> | | #include <xapian/base.h> | |
| #include <xapian/query.h> | | #include <xapian/query.h> | |
| #include <xapian/termiterator.h> | | #include <xapian/termiterator.h> | |
| #include <xapian/visibility.h> | | #include <xapian/visibility.h> | |
| | | | |
| #include <set> | | #include <set> | |
| #include <string> | | #include <string> | |
| | | | |
| namespace Xapian { | | namespace Xapian { | |
| | | | |
|
| class Database; | | | |
| class Stem; | | class Stem; | |
| | | | |
| /// Base class for stop-word decision functor. | | /// Base class for stop-word decision functor. | |
| class XAPIAN_VISIBILITY_DEFAULT Stopper { | | class XAPIAN_VISIBILITY_DEFAULT Stopper { | |
| public: | | public: | |
| /// Is term a stop-word? | | /// Is term a stop-word? | |
| virtual bool operator()(const std::string & term) const = 0; | | virtual bool operator()(const std::string & term) const = 0; | |
| | | | |
| /// Class has virtual methods, so provide a virtual destructor. | | /// Class has virtual methods, so provide a virtual destructor. | |
| virtual ~Stopper() { } | | virtual ~Stopper() { } | |
| | | | |
| /// Return a string describing this object. | | /// Return a string describing this object. | |
| virtual std::string get_description() const; | | virtual std::string get_description() const; | |
| }; | | }; | |
| | | | |
| /// Simple implementation of Stopper class - this will suit most users. | | /// Simple implementation of Stopper class - this will suit most users. | |
| class XAPIAN_VISIBILITY_DEFAULT SimpleStopper : public Stopper { | | class XAPIAN_VISIBILITY_DEFAULT SimpleStopper : public Stopper { | |
|
| private: | | | |
| std::set<std::string> stop_words; | | std::set<std::string> stop_words; | |
| | | | |
| public: | | public: | |
| /// Default constructor. | | /// Default constructor. | |
| SimpleStopper() { } | | SimpleStopper() { } | |
| | | | |
| /// Initialise from a pair of iterators. | | /// Initialise from a pair of iterators. | |
| #ifndef __SUNPRO_CC | | #ifndef __SUNPRO_CC | |
| template <class Iterator> | | template <class Iterator> | |
| SimpleStopper(Iterator begin, Iterator end) : stop_words(begin, end) {
} | | SimpleStopper(Iterator begin, Iterator end) : stop_words(begin, end) {
} | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 78 | |
| #endif | | #endif | |
| | | | |
| /// Add a single stop word. | | /// Add a single stop word. | |
| void add(const std::string & word) { stop_words.insert(word); } | | void add(const std::string & word) { stop_words.insert(word); } | |
| | | | |
| /// Is term a stop-word? | | /// Is term a stop-word? | |
| virtual bool operator()(const std::string & term) const { | | virtual bool operator()(const std::string & term) const { | |
| return stop_words.find(term) != stop_words.end(); | | return stop_words.find(term) != stop_words.end(); | |
| } | | } | |
| | | | |
|
| /// Destructor. | | | |
| virtual ~SimpleStopper() { } | | | |
| | | | |
| /// Return a string describing this object. | | /// Return a string describing this object. | |
| virtual std::string get_description() const; | | virtual std::string get_description() const; | |
| }; | | }; | |
| | | | |
| /// Base class for value range processors. | | /// Base class for value range processors. | |
| struct XAPIAN_VISIBILITY_DEFAULT ValueRangeProcessor { | | struct XAPIAN_VISIBILITY_DEFAULT ValueRangeProcessor { | |
| /// Destructor. | | /// Destructor. | |
| virtual ~ValueRangeProcessor(); | | virtual ~ValueRangeProcessor(); | |
| | | | |
|
| /** Check for a valid range of this type. | | /** See if <begin>..<end> is a valid value range. | |
| * | | * | |
|
| * If this ValueRangeProcessor recognises BEGIN..END it returns the | | * If this ValueRangeProcessor recognises <begin>..<end> it returns th | |
| * value number to range filter on. Otherwise it returns | | e | |
| | | * value number of range filter on. Otherwise it returns | |
| * Xapian::BAD_VALUENO. | | * Xapian::BAD_VALUENO. | |
| */ | | */ | |
| virtual Xapian::valueno operator()(std::string &begin, std::string &end
) = 0; | | virtual Xapian::valueno operator()(std::string &begin, std::string &end
) = 0; | |
| }; | | }; | |
| | | | |
| /** Handle a string range. | | /** Handle a string range. | |
| * | | * | |
| * The end points can be any strings. | | * The end points can be any strings. | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT StringValueRangeProcessor : public ValueRan
geProcessor { | | class XAPIAN_VISIBILITY_DEFAULT StringValueRangeProcessor : public ValueRan
geProcessor { | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 141 | |
| * month/day/year rather than day/month/year? | | * month/day/year rather than day/month/year? | |
| * (default: false) | | * (default: false) | |
| * @param epoch_year_ Year to use as the epoch for dates with 2 digit | | * @param epoch_year_ Year to use as the epoch for dates with 2 digit | |
| * years (default: 1970, so 1/1/69 is 2069 while | | * years (default: 1970, so 1/1/69 is 2069 while | |
| * 1/1/70 is 1970). | | * 1/1/70 is 1970). | |
| */ | | */ | |
| DateValueRangeProcessor(Xapian::valueno valno_, bool prefer_mdy_ = fals
e, | | DateValueRangeProcessor(Xapian::valueno valno_, bool prefer_mdy_ = fals
e, | |
| int epoch_year_ = 1970) | | int epoch_year_ = 1970) | |
| : valno(valno_), prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) {
} | | : valno(valno_), prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) {
} | |
| | | | |
|
| /** Check for a valid range of this type. | | /** See if <begin>..<end> is a valid date value range. | |
| * | | * | |
|
| * If BEGIN..END is a sensible date range, this method returns the | | * If <begin>..<end> is a sensible date range, this method returns the | |
| * value number of range filter on. Otherwise it returns | | * value number of range filter on. Otherwise it returns | |
| * Xapian::BAD_VALUENO. | | * Xapian::BAD_VALUENO. | |
| */ | | */ | |
| Xapian::valueno operator()(std::string &begin, std::string &end); | | Xapian::valueno operator()(std::string &begin, std::string &end); | |
| }; | | }; | |
| | | | |
|
| // Xapian 1.0.0 and 1.0.1 had a conceptually broken implementation of | | | |
| // NumberValueRangeProcessor which we quickly told people to avoid using. | | | |
| But | | | |
| // to keep ABI compatibility, we should keep it around until the next | | | |
| // incompatible ABI change (in 1.1.0). So we put the new | | | |
| // NumberValueRangeProcessor in a subnamespace and then pull it into this o | | | |
| ne | | | |
| // with "using v102::NumberValueRangeProcessor". The old | | | |
| // NumberValueRangeProcessor still exists with default visibility, but isn' | | | |
| t | | | |
| // declared in an external or internal header, so will only be used when | | | |
| // dynamically linking with application code built against Xapian 1.0.0 or | | | |
| // 1.0.1. | | | |
| #ifndef DOXYGEN | | | |
| // Hide the v102 namespace from Doxygen as it isn't user-visible. | | | |
| namespace v102 { | | | |
| #endif | | | |
| | | | |
| /** Handle a number range. | | /** Handle a number range. | |
| * | | * | |
| * This class must be used on values which have been encoded using | | * This class must be used on values which have been encoded using | |
| * Xapian::sortable_serialise() which turns numbers into strings which | | * Xapian::sortable_serialise() which turns numbers into strings which | |
| * will sort in the same order as the numbers (the same values can be | | * will sort in the same order as the numbers (the same values can be | |
| * used to implement a numeric sort). | | * used to implement a numeric sort). | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT NumberValueRangeProcessor : public ValueRan
geProcessor { | | class XAPIAN_VISIBILITY_DEFAULT NumberValueRangeProcessor : public ValueRan
geProcessor { | |
| Xapian::valueno valno; | | Xapian::valueno valno; | |
| bool prefix; | | bool prefix; | |
| | | | |
| skipping to change at line 226 | | skipping to change at line 206 | |
| * processor has been added to the queryparser, the queryparser will | | * processor has been added to the queryparser, the queryparser will | |
| * accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as va
lid | | * accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as va
lid | |
| * ranges. If str_ is "kg" and prefix_ is false, the queryparser will | | * ranges. If str_ is "kg" and prefix_ is false, the queryparser will | |
| * accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" a
s | | * accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" a
s | |
| * valid ranges. | | * valid ranges. | |
| */ | | */ | |
| NumberValueRangeProcessor(Xapian::valueno valno_, const std::string &st
r_, | | NumberValueRangeProcessor(Xapian::valueno valno_, const std::string &st
r_, | |
| bool prefix_ = true) | | bool prefix_ = true) | |
| : valno(valno_), prefix(prefix_), str(str_) { } | | : valno(valno_), prefix(prefix_), str(str_) { } | |
| | | | |
|
| /** Check for a valid range of this type. | | /** See if <begin>..<end> is a valid numeric value range. | |
| * | | * | |
|
| * If BEGIN..END is a valid numeric value range, and has the | | * If <begin>..<end> is a valid numeric value range, and has the | |
| * appropriate prefix or suffix (if specified) required for this | | * appropriate prefix or suffix (if specified) required for this | |
| * NumberValueRangeProcessor, this method returns the value number of | | * NumberValueRangeProcessor, this method returns the value number of | |
| * range filter on, and sets begin and end to the appropriate serialis
ed | | * range filter on, and sets begin and end to the appropriate serialis
ed | |
| * values needed to delimit the range. Otherwise it returns | | * values needed to delimit the range. Otherwise it returns | |
| * Xapian::BAD_VALUENO. | | * Xapian::BAD_VALUENO. | |
| */ | | */ | |
| Xapian::valueno operator()(std::string &begin, std::string &end); | | Xapian::valueno operator()(std::string &begin, std::string &end); | |
| }; | | }; | |
| | | | |
|
| #ifndef DOXYGEN | | | |
| } | | | |
| | | | |
| # ifndef XAPIAN_NO_V102_NUMBER_VRP | | | |
| using v102::NumberValueRangeProcessor; | | | |
| # endif | | | |
| #endif | | | |
| | | | |
| /// Build a Xapian::Query object from a user query string. | | /// Build a Xapian::Query object from a user query string. | |
| class XAPIAN_VISIBILITY_DEFAULT QueryParser { | | class XAPIAN_VISIBILITY_DEFAULT QueryParser { | |
| public: | | public: | |
| /// Class representing the queryparser internals. | | /// Class representing the queryparser internals. | |
| class Internal; | | class Internal; | |
| /// @private @internal Reference counted internals. | | /// @private @internal Reference counted internals. | |
| Xapian::Internal::RefCntPtr<Internal> internal; | | Xapian::Internal::RefCntPtr<Internal> internal; | |
| | | | |
| /// Enum of feature flags. | | /// Enum of feature flags. | |
| typedef enum { | | typedef enum { | |
| /// Support AND, OR, etc and bracketed subexpressions. | | /// Support AND, OR, etc and bracketed subexpressions. | |
| FLAG_BOOLEAN = 1, | | FLAG_BOOLEAN = 1, | |
| /// Support quoted phrases. | | /// Support quoted phrases. | |
| FLAG_PHRASE = 2, | | FLAG_PHRASE = 2, | |
| /// Support + and -. | | /// Support + and -. | |
| FLAG_LOVEHATE = 4, | | FLAG_LOVEHATE = 4, | |
| /// Support AND, OR, etc even if they aren't in ALLCAPS. | | /// Support AND, OR, etc even if they aren't in ALLCAPS. | |
| FLAG_BOOLEAN_ANY_CASE = 8, | | FLAG_BOOLEAN_ANY_CASE = 8, | |
| /** Support right truncation (e.g. Xap*). | | /** Support right truncation (e.g. Xap*). | |
| * | | * | |
|
| * Currently you can't use wildcards with boolean filter prefixes, | | | |
| * or in a phrase (either an explicitly quoted one, or one implicit | | | |
| ly | | | |
| * generated by hyphens or other punctuation). | | | |
| * | | | |
| * NB: You need to tell the QueryParser object which database to | | * NB: You need to tell the QueryParser object which database to | |
| * expand wildcards from by calling set_database. | | * expand wildcards from by calling set_database. | |
| */ | | */ | |
| FLAG_WILDCARD = 16, | | FLAG_WILDCARD = 16, | |
| /** Allow queries such as 'NOT apples'. | | /** Allow queries such as 'NOT apples'. | |
| * | | * | |
| * These require the use of a list of all documents in the database | | * These require the use of a list of all documents in the database | |
| * which is potentially expensive, so this feature isn't enabled by | | * which is potentially expensive, so this feature isn't enabled by | |
| * default. | | * default. | |
| */ | | */ | |
| FLAG_PURE_NOT = 32, | | FLAG_PURE_NOT = 32, | |
| /** Enable partial matching. | | /** Enable partial matching. | |
| * | | * | |
| * Partial matching causes the parser to treat the query as a | | * Partial matching causes the parser to treat the query as a | |
| * "partially entered" search. This will automatically treat the | | * "partially entered" search. This will automatically treat the | |
| * final word as a wildcarded match, unless it is followed by | | * final word as a wildcarded match, unless it is followed by | |
| * whitespace, to produce more stable results from interactive | | * whitespace, to produce more stable results from interactive | |
| * searches. | | * searches. | |
| * | | * | |
|
| * Currently FLAG_PARTIAL doesn't do anything if the final word | | | |
| * in the query has a boolean filter prefix, or if it is in a phras | | | |
| e | | | |
| * (either an explicitly quoted one, or one implicitly generated by | | | |
| * hyphens or other punctuation). It also doesn't do anything if | | | |
| * if the final word is part of a value range. | | | |
| * | | | |
| * NB: You need to tell the QueryParser object which database to | | * NB: You need to tell the QueryParser object which database to | |
| * expand wildcards from by calling set_database. | | * expand wildcards from by calling set_database. | |
| */ | | */ | |
| FLAG_PARTIAL = 64, | | FLAG_PARTIAL = 64, | |
| | | | |
| /** Enable spelling correction. | | /** Enable spelling correction. | |
| * | | * | |
| * For each word in the query which doesn't exist as a term in the | | * For each word in the query which doesn't exist as a term in the | |
| * database, Database::get_spelling_suggestion() will be called and
if | | * database, Database::get_spelling_suggestion() will be called and
if | |
| * a suggestion is returned, a corrected version of the query strin
g | | * a suggestion is returned, a corrected version of the query strin
g | |
| | | | |
| skipping to change at line 389 | | skipping to change at line 351 | |
| * prefix is added). | | * prefix is added). | |
| * | | * | |
| * Note that the stemming algorithm is only applied to words in | | * Note that the stemming algorithm is only applied to words in | |
| * probabilistic fields - boolean filter terms are never stemmed. | | * probabilistic fields - boolean filter terms are never stemmed. | |
| */ | | */ | |
| void set_stemming_strategy(stem_strategy strategy); | | void set_stemming_strategy(stem_strategy strategy); | |
| | | | |
| /// Set the stopper. | | /// Set the stopper. | |
| void set_stopper(const Stopper *stop = NULL); | | void set_stopper(const Stopper *stop = NULL); | |
| | | | |
|
| /** Set the default operator. | | /** Set the default boolean operator. */ | |
| * | | | |
| * This operator is used to combine non-filter query items when no | | | |
| * explicit operator is used. | | | |
| * | | | |
| * The most useful values for this are OP_OR (the default) and OP_AND. | | | |
| * OP_NEAR and OP_PHRASE can also be useful. | | | |
| * | | | |
| * So for example, 'weather forecast' is parsed as if it were 'weather | | | |
| OR | | | |
| * forecast' by default. | | | |
| */ | | | |
| void set_default_op(Query::op default_op); | | void set_default_op(Query::op default_op); | |
| | | | |
|
| /** Get the current default operator. */ | | /** Get the default boolean operator. */ | |
| Query::op get_default_op() const; | | Query::op get_default_op() const; | |
| | | | |
|
| /** Specify the database being searched. | | /// Specify the database being searched. | |
| * | | | |
| * The database is used for wildcard expansion (FLAG_WILDCARD and | | | |
| * FLAG_PARTIAL), spelling correction (FLAG_SPELLING_CORRECTION), and | | | |
| * synonyms (FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, and | | | |
| * FLAG_AUTO_MULTIWORD_SYNONYMS). | | | |
| */ | | | |
| void set_database(const Database &db); | | void set_database(const Database &db); | |
| | | | |
| /** Parse a query. | | /** Parse a query. | |
| * | | * | |
| * @param query_string A free-text query as entered by a user | | * @param query_string A free-text query as entered by a user | |
| * @param flags Zero or more Query::feature_flag specifying | | * @param flags Zero or more Query::feature_flag specifying | |
| * what features the QueryParser should support. Combine | | * what features the QueryParser should support. Combine | |
| * multiple values with bitwise-or (|) (default FLAG_DEFAULT). | | * multiple values with bitwise-or (|) (default FLAG_DEFAULT). | |
| * @param default_prefix The default term prefix to use (default none)
. | | * @param default_prefix The default term prefix to use (default none)
. | |
| * For example, you can pass "A" when parsing an "Author" field
. | | * For example, you can pass "A" when parsing an "Author" field
. | |
|
| * | | | |
| * @exception If the query string can't be parsed, then | | | |
| * Xapian::QueryParserError is thrown. You can get an Engli | | | |
| sh | | | |
| * error message to report to the user by catching it and | | | |
| * calling get_msg() on the caught exception. The current | | | |
| * possible values (in case you want to translate them) are: | | | |
| * | | | |
| * @li Unknown range operation | | | |
| * @li parse error | | | |
| * @li Syntax: <expression> AND <expression> | | | |
| * @li Syntax: <expression> AND NOT <expression> | | | |
| * @li Syntax: <expression> NOT <expression> | | | |
| * @li Syntax: <expression> OR <expression> | | | |
| * @li Syntax: <expression> XOR <expression> | | | |
| */ | | */ | |
| Query parse_query(const std::string &query_string, | | Query parse_query(const std::string &query_string, | |
|
| unsigned flags = FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHAT | | unsigned flags = FLAG_DEFAULT, | |
| E, | | const std::string &default_prefix = std::string()); | |
| const std::string &default_prefix = ""); | | | |
| | | | |
| /** Add a probabilistic term prefix. | | /** Add a probabilistic term prefix. | |
| * | | * | |
| * For example: | | * For example: | |
| * | | * | |
| * @code | | * @code | |
| * qp.add_prefix("author", "A"); | | * qp.add_prefix("author", "A"); | |
| * @endcode | | * @endcode | |
| * | | * | |
| * This allows the user to search for author:Orwell which will be | | * This allows the user to search for author:Orwell which will be | |
| | | | |
| skipping to change at line 462 | | skipping to change at line 394 | |
| * Multiple fields can be mapped to the same prefix. For example, you | | * Multiple fields can be mapped to the same prefix. For example, you | |
| * can make title: and subject: aliases for each other. | | * can make title: and subject: aliases for each other. | |
| * | | * | |
| * As of 1.0.4, you can call this method multiple times with the same | | * As of 1.0.4, you can call this method multiple times with the same | |
| * value of field to allow a single field to be mapped to multiple | | * value of field to allow a single field to be mapped to multiple | |
| * prefixes. Multiple terms being generated for such a field, and | | * prefixes. Multiple terms being generated for such a field, and | |
| * combined with @c Xapian::Query::OP_OR. | | * combined with @c Xapian::Query::OP_OR. | |
| * | | * | |
| * If any prefixes are specified for the empty field name (i.e. you | | * If any prefixes are specified for the empty field name (i.e. you | |
| * call this method with an empty string as the first parameter) | | * call this method with an empty string as the first parameter) | |
|
| * these prefixes will be used for terms without a field specifier. | | * these prefixes will be used as the default prefix. If you do | |
| * If you do this and also specify the @c default_prefix parameter to | | * this and also specify the @c default_prefix parameter to | |
| @c | | * @c parse_query(), then the @c default_prefix parameter will overrid | |
| * parse_query(), then the @c default_prefix parameter will override. | | e. | |
| * | | | |
| * If the prefix parameter is empty, then "field:word" will produce th | | | |
| e | | | |
| * term "word" (and this can be one of several prefixes for a particul | | | |
| ar | | | |
| * field, or for terms without a field specifier). | | | |
| * | | * | |
| * If you call @c add_prefix() and @c add_boolean_prefix() for the | | * If you call @c add_prefix() and @c add_boolean_prefix() for the | |
| * same value of @a field, a @c Xapian::InvalidOperationError exceptio
n | | * same value of @a field, a @c Xapian::InvalidOperationError exceptio
n | |
| * will be thrown. | | * will be thrown. | |
| * | | * | |
| * In 1.0.3 and earlier, subsequent calls to this method with the same | | * In 1.0.3 and earlier, subsequent calls to this method with the same | |
| * value of @a field had no effect. | | * value of @a field had no effect. | |
| * | | * | |
| * @param field The user visible field name | | * @param field The user visible field name | |
| * @param prefix The term prefix to map this to | | * @param prefix The term prefix to map this to | |
| | | | |
End of changes. 20 change blocks. |
| 99 lines changed or deleted | | 18 lines changed or added | |
|
| valueiterator.h | | valueiterator.h | |
|
| /** \file valueiterator.h | | /** @file valueiterator.h | |
| * \brief classes for iterating through values | | * @brief Class for iterating over document values. | |
| */ | | */ | |
|
| /* Copyright 1999,2000,2001 BrightStation PLC | | /* Copyright (C) 2008,2009 Olly Betts | |
| * Copyright 2002 Ananova Ltd | | | |
| * Copyright 2002,2003,2004,2007 Olly Betts | | | |
| * | | * | |
| * This program is free software; you can redistribute it and/or | | * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | | * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU General Public License | | * You should have received a copy of the GNU General Public License | |
| * along with this program; if not, write to the Free Software | | * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 | | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 | |
| * USA | | * USA | |
| */ | | */ | |
| | | | |
|
| #ifndef OM_HGUARD_OMVALUEITERATOR_H | | #ifndef XAPIAN_INCLUDED_VALUEITERATOR_H | |
| #define OM_HGUARD_OMVALUEITERATOR_H | | #define XAPIAN_INCLUDED_VALUEITERATOR_H | |
| | | | |
| #include <iterator> | | #include <iterator> | |
| #include <string> | | #include <string> | |
|
| | | | |
| | | #include <xapian/base.h> | |
| | | #include <xapian/derefwrapper.h> | |
| #include <xapian/types.h> | | #include <xapian/types.h> | |
|
| #include <xapian/document.h> | | | |
| #include <xapian/visibility.h> | | #include <xapian/visibility.h> | |
| | | | |
| namespace Xapian { | | namespace Xapian { | |
| | | | |
|
| /** An iterator pointing to values associated with a document. | | /// @internal A proxy class for an end ValueIterator. | |
| */ | | class ValueIteratorEnd_ { }; | |
| | | | |
| | | /// Class for iterating over document values. | |
| class XAPIAN_VISIBILITY_DEFAULT ValueIterator { | | class XAPIAN_VISIBILITY_DEFAULT ValueIterator { | |
|
| private: | | public: | |
| friend class Document; | | /// Class representing the valueiterator internals. | |
| friend bool operator==(const ValueIterator &a, const ValueIterator | | class Internal; | |
| &b); | | /// @private @internal Reference counted internals. | |
| friend bool operator!=(const ValueIterator &a, const ValueIterator | | Xapian::Internal::RefCntPtr<Internal> internal; | |
| &b); | | | |
| | | | |
|
| ValueIterator(Xapian::valueno index_, const Document & doc_) | | /// @private @internal Construct given internals. | |
| : index(index_), doc(doc_) { } | | explicit ValueIterator(Internal *internal_); | |
| | | | |
|
| Xapian::valueno index; | | /// Copy constructor. | |
| Document doc; | | ValueIterator(const ValueIterator & o); | |
| | | | |
|
| public: | | /// @internal Copy from an end iterator proxy. | |
| /** Create an uninitialised iterator; this cannot be used, but is | | ValueIterator(const ValueIteratorEnd_ &); | |
| * convenient syntactically. | | | |
| */ | | | |
| ValueIterator() : index(0), doc() { } | | | |
| | | | |
|
| ~ValueIterator() { } | | /// Assignment. | |
| | | ValueIterator & operator=(const ValueIterator & o); | |
| | | | |
|
| /// Copying is allowed (and is cheap). | | /// @internal Assignment of an end iterator proxy. | |
| ValueIterator(const ValueIterator &other) { | | ValueIterator & operator=(const ValueIteratorEnd_ &); | |
| index = other.index; | | | |
| doc = other.doc; | | | |
| } | | | |
| | | | |
|
| /// Assignment is allowed (and is cheap). | | /** Default constructor. | |
| void operator=(const ValueIterator &other) { | | * | |
| index = other.index; | | * Creates an uninitialised iterator, which can't be used before being | |
| doc = other.doc; | | * assigned to, but is sometimes syntactically convenient. | |
| } | | */ | |
| | | ValueIterator(); | |
| | | | |
|
| /// Advance the iterator. | | /// Destructor. | |
| ValueIterator & operator++() { | | ~ValueIterator(); | |
| ++index; | | | |
| return *this; | | | |
| } | | | |
| | | | |
|
| /// Advance the iterator (postfix variant). | | /// Return the value at the current position. | |
| ValueIterator operator++(int) { | | std::string operator*() const; | |
| ValueIterator tmp = *this; | | | |
| ++index; | | | |
| return tmp; | | | |
| } | | | |
| | | | |
|
| /// Get the value for the current position. | | /// Advance the iterator to the next position. | |
| const std::string & operator*() const; | | ValueIterator & operator++(); | |
| | | | |
|
| /// Get the value for the current position. | | /// Advance the iterator to the next position (postfix version). | |
| const std::string * operator->() const; | | DerefStringWrapper_ operator++(int) { | |
| | | std::string value(**this); | |
| | | operator++(); | |
| | | return DerefStringWrapper_(value); | |
| | | } | |
| | | | |
|
| /// Get the number of the value at the current position | | /** Return the docid at the current position. | |
| Xapian::valueno get_valueno() const; | | * | |
| | | * If we're iterating over values of a document, this method will thro | |
| | | w | |
| | | * Xapian::InvalidOperationError. | |
| | | */ | |
| | | Xapian::docid get_docid() const; | |
| | | | |
|
| /// Return a string describing this object. | | /** Return the value slot number for the current position. | |
| std::string get_description() const; | | * | |
| | | * If the iterator is over all values in a slot, this returns that slo | |
| | | t's | |
| | | * number. If the iterator is over the values in a particular documen | |
| | | t, | |
| | | * it returns the number of each slot in turn. | |
| | | */ | |
| | | Xapian::valueno get_valueno() const; | |
| | | | |
|
| /// Allow use as an STL iterator | | /** Advance the iterator to document id or value slot @a docid_or_slot. | |
| //@{ | | * | |
| typedef std::input_iterator_tag iterator_category; | | * If this iterator is over values in a document, then this method | |
| typedef std::string value_type; | | * advances the iterator to value slot @a docid_or_slot, or the first | |
| typedef Xapian::valueno_diff difference_type; | | slot | |
| typedef std::string * pointer; | | * after it if there is no value in slot @a slot. | |
| typedef std::string & reference; | | * | |
| //@} | | * If this iterator is over values in a particular slot, then this | |
| | | * method advances the iterator to document id @a docid_or_slot, or th | |
| | | e | |
| | | * first document id after it if there is no value in the slot we're | |
| | | * iterating over for document @a docid_or_slot. | |
| | | * | |
| | | * Note: The "two-faced" nature of this method is due to how C++ | |
| | | * overloading works. Xapian::docid and Xapian::valueno are both type | |
| | | defs | |
| | | * for the same unsigned integer type, so overloading can't distinguis | |
| | | h | |
| | | * them. | |
| | | */ | |
| | | void skip_to(Xapian::docid docid_or_slot); | |
| | | | |
| | | /** Check if the specified docid occurs. | |
| | | * | |
| | | * The caller is required to ensure that the specified document id | |
| | | * @a did actually exists in the database. | |
| | | * | |
| | | * This method acts like skip_to() if that can be done at little extra | |
| | | * cost, in which case it then returns true. This is how chert behave | |
| | | s | |
| | | * because it stores values in streams which allow for an efficient | |
| | | * implementation of skip_to(). | |
| | | * | |
| | | * Otherwise it simply checks if a particular docid is present. If it | |
| | | * is, it returns true. If it isn't, it returns false, and leaves the | |
| | | * position unspecified (and hence the result of calling methods which | |
| | | * depends on the current position, such as get_docid(), are also | |
| | | * unspecified). In this state, next() will advance to the first matc | |
| | | hing | |
| | | * position after document @a did, and skip_to() will act as it would | |
| | | if | |
| | | * the position was the first matching position after document @a did. | |
| | | * | |
| | | * Currently the inmemory, flint, and remote backends behave in the | |
| | | * latter way because they don't support streamed values and so skip_t | |
| | | o() | |
| | | * must check each document it skips over which is significantly slowe | |
| | | r. | |
| | | */ | |
| | | bool check(Xapian::docid docid); | |
| | | | |
| | | /// Return a string describing this object. | |
| | | std::string get_description() const; | |
| | | | |
| | | /** @private @internal ValueIterator is what the C++ STL calls an | |
| | | * input_iterator. | |
| | | * | |
| | | * The following typedefs allow std::iterator_traits<> to work so that | |
| | | * this iterator can be used with with STL. | |
| | | * | |
| | | * These are deliberately hidden from the Doxygen-generated docs, as t | |
| | | he | |
| | | * machinery here isn't interesting to API users. They just need to k | |
| | | now | |
| | | * that Xapian iterator classes are compatible with the STL. | |
| | | */ | |
| | | // @{ | |
| | | /// @private | |
| | | typedef std::input_iterator_tag iterator_category; | |
| | | /// @private | |
| | | typedef std::string value_type; | |
| | | /// @private | |
| | | typedef Xapian::doccount_diff difference_type; | |
| | | /// @private | |
| | | typedef std::string * pointer; | |
| | | /// @private | |
| | | typedef std::string & reference; | |
| | | // @} | |
| }; | | }; | |
| | | | |
|
| /// Equality test for ValueIterator objects. | | inline bool | |
| inline bool operator==(const ValueIterator &a, const ValueIterator &b) | | operator==(const ValueIterator &a, const ValueIterator &b) | |
| { | | { | |
|
| return (a.index == b.index); | | // Use a pointer comparison - this ensures both that (a == a) and corre | |
| | | ct | |
| | | // handling of end iterators (which we ensure have NULL internals). | |
| | | return a.internal.get() == b.internal.get(); | |
| } | | } | |
| | | | |
|
| /// Inequality test for ValueIterator objects. | | inline bool | |
| inline bool operator!=(const ValueIterator &a, const ValueIterator &b) | | operator==(const ValueIterator &a, const ValueIteratorEnd_ &) | |
| { | | { | |
|
| return (a.index != b.index); | | return a.internal.get() == NULL; | |
| } | | } | |
| | | | |
|
| | | inline bool | |
| | | operator==(const ValueIteratorEnd_ &a, const ValueIterator &b) | |
| | | { | |
| | | return b == a; | |
| } | | } | |
| | | | |
|
| #endif /* OM_HGUARD_OMVALUEITERATOR_H */ | | inline bool | |
| | | operator==(const ValueIteratorEnd_ &, const ValueIteratorEnd_ &) | |
| | | { | |
| | | return true; | |
| | | } | |
| | | | |
| | | inline bool | |
| | | operator!=(const ValueIterator &a, const ValueIterator &b) | |
| | | { | |
| | | return !(a == b); | |
| | | } | |
| | | | |
| | | inline bool | |
| | | operator!=(const ValueIterator &a, const ValueIteratorEnd_ &b) | |
| | | { | |
| | | return !(a == b); | |
| | | } | |
| | | | |
| | | inline bool | |
| | | operator!=(const ValueIteratorEnd_ &a, const ValueIterator &b) | |
| | | { | |
| | | return !(a == b); | |
| | | } | |
| | | | |
| | | inline bool | |
| | | operator!=(const ValueIteratorEnd_ &a, const ValueIteratorEnd_ &b) | |
| | | { | |
| | | return !(a == b); | |
| | | } | |
| | | | |
| | | } | |
| | | | |
| | | #endif // XAPIAN_INCLUDED_VALUEITERATOR_H | |
| | | | |
End of changes. 26 change blocks. |
| 69 lines changed or deleted | | 152 lines changed or added | |
|