base.h | base.h | |||
---|---|---|---|---|
/** @file base.h | /* base.h: Reference-counted pointers | |||
* @brief Reference-counted pointers | * | |||
*/ | * Copyright 1999,2000,2001 BrightStation PLC | |||
/* Copyright 1999,2000,2001 BrightStation PLC | ||||
* Copyright 2002 Ananova Ltd | * Copyright 2002 Ananova Ltd | |||
* Copyright 2002,2003,2004,2007 Olly Betts | * 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 | |||
End of changes. 1 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added | |||
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 | |||
dbfactory.h | dbfactory.h | |||
---|---|---|---|---|
/** \file dbfactory.h | /** \file dbfactory.h | |||
* \brief Factory functions for constructing Database and WritableDatabase objects | * \brief Factory functions for constructing Database and WritableDatabase objects | |||
*/ | */ | |||
/* Copyright (C) 2005,2006,2007,2008,2009 Olly Betts | /* Copyright (C) 2005,2006,2007,2008 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 28 | skipping to change at line 28 | |||
* 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 XAPIAN_INCLUDED_DBFACTORY_H | #ifndef XAPIAN_INCLUDED_DBFACTORY_H | |||
#define XAPIAN_INCLUDED_DBFACTORY_H | #define XAPIAN_INCLUDED_DBFACTORY_H | |||
#include <string> | #include <string> | |||
#include <xapian/types.h> | #include <xapian/types.h> | |||
#include <xapian/deprecated.h> | ||||
#include <xapian/version.h> | #include <xapian/version.h> | |||
#include <xapian/visibility.h> | #include <xapian/visibility.h> | |||
namespace Xapian { | namespace Xapian { | |||
class Database; | class Database; | |||
class WritableDatabase; | class WritableDatabase; | |||
/// Database factory functions which determine the database type automatica lly. | ||||
namespace Auto { | namespace Auto { | |||
/** Construct a Database object for a stub database file. | /** Construct a Database object for a stub database file. | |||
* | * | |||
* The stub database file contains serialised parameters for one | * The stub database file contains serialised parameters for one | |||
* or more databases. | * or more databases. | |||
* | * | |||
* @param file pathname of the stub database file. | * @param file pathname of the stub database file. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
Database open_stub(const std::string &file); | Database open_stub(const std::string &file); | |||
/** Construct a WritableDatabase object for a stub database file. | ||||
* | ||||
* The stub database file must contain serialised parameters for exactly on | ||||
e | ||||
* database. | ||||
* | ||||
* @param file pathname of the stub database file. | ||||
*/ | ||||
XAPIAN_VISIBILITY_DEFAULT | ||||
WritableDatabase open_stub(const std::string &file, int action); | ||||
} | } | |||
#ifdef XAPIAN_HAS_INMEMORY_BACKEND | #ifdef XAPIAN_HAS_INMEMORY_BACKEND | |||
/// Database factory functions for the inmemory backend. | ||||
namespace InMemory { | namespace InMemory { | |||
/** Construct a WritableDatabase object for a new, empty InMemory database. | /** Construct a WritableDatabase object for a new, empty InMemory database. | |||
* | * | |||
* Only a writable InMemory database can be created, since a read-only one | * Only a writable InMemory database can be created, since a read-only one | |||
* would always remain empty. | * would always remain empty. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
WritableDatabase open(); | WritableDatabase open(); | |||
} | } | |||
#endif | #endif | |||
#ifdef XAPIAN_HAS_QUARTZ_BACKEND | #ifdef XAPIAN_HAS_CHERT_BACKEND | |||
/// Database factory functions for the quartz backend. | namespace Chert { | |||
namespace Quartz { | ||||
/** Construct a Database object for read-only access to a Quartz database. | /** Construct a Database object for read-only access to a Chert database. | |||
* | ||||
* The Quartz backend is deprecated - use the Flint backend instead. | ||||
* | * | |||
* @param dir pathname of the directory containing the database. | * @param dir pathname of the directory containing the database. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
XAPIAN_DEPRECATED(Database open(const std::string &dir)); | Database open(const std::string &dir); | |||
/** Construct a Database object for update access to a Quartz database. | /** Construct a Database object for update access to a Chert database. | |||
* | ||||
* The Quartz backend is deprecated - use the Flint backend instead. | ||||
* | * | |||
* @param dir pathname of the directory containing the database. | * @param dir pathname of the directory containing the database. | |||
* @param action determines handling of existing/non-existing databas e: | * @param action determines handling of existing/non-existing databas e: | |||
* - Xapian::DB_CREATE fail if database already exi st, | * - Xapian::DB_CREATE fail if database already exi st, | |||
* otherwise create new database. | * otherwise create new database. | |||
* - Xapian::DB_CREATE_OR_OPEN open existing database, or c reate new | * - Xapian::DB_CREATE_OR_OPEN open existing database, or c reate new | |||
* database if none exists. | * database if none exists. | |||
* - Xapian::DB_CREATE_OR_OVERWRITE overwrite existing database, or crea te | * - Xapian::DB_CREATE_OR_OVERWRITE overwrite existing database, or crea te | |||
* new database if none exists. | * new database if none exists. | |||
* - Xapian::DB_OPEN open existing database, failing if n one | * - Xapian::DB_OPEN open existing database, failing if n one | |||
* exists. | * exists. | |||
* @param block_size the Btree blocksize to use (in bytes), which must be a | * @param block_size the Btree blocksize to use (in bytes), which must be a | |||
* power of two between 2048 and 65536 (inclusive). Th e | * power of two between 2048 and 65536 (inclusive). Th e | |||
* default (also used if an invalid value if passed) is | * default (also used if an invalid value if passed) is | |||
* 8192 bytes. This parameter is ignored when opening an | * 8192 bytes. This parameter is ignored when opening an | |||
* existing database. | * existing database. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
XAPIAN_DEPRECATED(WritableDatabase | WritableDatabase | |||
open(const std::string &dir, int action, int block_size = 8192)); | open(const std::string &dir, int action, int block_size = 8192); | |||
} | } | |||
#endif | #endif | |||
#ifdef XAPIAN_HAS_FLINT_BACKEND | #ifdef XAPIAN_HAS_FLINT_BACKEND | |||
/// Database factory functions for the flint backend. | ||||
namespace Flint { | namespace Flint { | |||
/** Construct a Database object for read-only access to a Flint database. | /** Construct a Database object for read-only access to a Flint database. | |||
* | * | |||
* @param dir pathname of the directory containing the database. | * @param dir pathname of the directory containing the database. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
Database open(const std::string &dir); | Database open(const std::string &dir); | |||
/** Construct a Database object for update access to a Flint database. | /** Construct a Database object for update access to a Flint database. | |||
skipping to change at line 144 | skipping to change at line 145 | |||
* existing database. | * existing database. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
WritableDatabase | WritableDatabase | |||
open(const std::string &dir, int action, int block_size = 8192); | open(const std::string &dir, int action, int block_size = 8192); | |||
} | } | |||
#endif | #endif | |||
#ifdef XAPIAN_HAS_REMOTE_BACKEND | #ifdef XAPIAN_HAS_REMOTE_BACKEND | |||
/// Database factory functions for the remote backend. | ||||
namespace Remote { | namespace Remote { | |||
/** Construct a Database object for read-only access to a remote database | /** Construct a Database object for read-only access to a remote database | |||
* accessed via a TCP connection. | * accessed via a TCP connection. | |||
* | * | |||
* Access to the remote database is via a TCP connection to the specified | * Access to the remote database is via a TCP connection to the specified | |||
* host and port. | * host and port. | |||
* | * | |||
* @param host hostname to connect to. | * @param host hostname to connect to. | |||
* @param port port number to connect to. | * @param port port number to connect to. | |||
End of changes. 12 change blocks. | ||||
18 lines changed or deleted | 19 lines changed or added | |||
deprecated.h | deprecated.h | |||
---|---|---|---|---|
/** @file deprecated.h | // deprecated.h: Define XAPIAN_DEPRECATED() macro. | |||
* @brief Define XAPIAN_DEPRECATED() macro. | // | |||
*/ | ||||
// Copyright (C) 2006,2007,2009 Olly Betts | // Copyright (C) 2006,2007,2009 Olly Betts | |||
// | // | |||
// This program is free software; you can redistribute it and/or modify | // This program is free software; you can redistribute it and/or modify | |||
// it under the terms of the GNU General Public License as published by | // it under the terms of the GNU General Public License as published by | |||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | |||
// (at your option) any later version. | // (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 | |||
skipping to change at line 32 | skipping to change at line 31 | |||
// How to use of the XAPIAN_DEPRECATED is document in HACKING - see the | // How to use of the XAPIAN_DEPRECATED is document in HACKING - see the | |||
// section "Marking Features as Deprecated". Don't forget to update the | // section "Marking Features as Deprecated". Don't forget to update the | |||
// documentation of deprecated methods for end users in docs/deprecation.rs t | // documentation of deprecated methods for end users in docs/deprecation.rs t | |||
// too! | // too! | |||
// xapian-bindings needs to wrap deprecated functions without warnings, | // xapian-bindings needs to wrap deprecated functions without warnings, | |||
// so check if XAPIAN_DEPRECATED is defined so xapian-bindings can override | // so check if XAPIAN_DEPRECATED is defined so xapian-bindings can override | |||
// it. | // it. | |||
#ifndef XAPIAN_DEPRECATED | #ifndef XAPIAN_DEPRECATED | |||
# if defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ | # ifdef __GNUC__ | |||
> 0)) | // __attribute__((__deprecated__)) is supported by GCC 3.1 and later, which | |||
// __attribute__((__deprecated__)) is supported by GCC 3.1 and later. | // is now our minimum requirement, so there's no need to check the GCC vers | |||
ion | ||||
// in use. | ||||
# define XAPIAN_DEPRECATED(D) D __attribute__((__deprecated__)) | # define XAPIAN_DEPRECATED(D) D __attribute__((__deprecated__)) | |||
# elif defined _MSC_VER && _MSC_VER >= 1300 | # elif defined _MSC_VER && _MSC_VER >= 1300 | |||
// __declspec(deprecated) is supported by MSVC 7.0 and later. | // __declspec(deprecated) is supported by MSVC 7.0 and later. | |||
# define XAPIAN_DEPRECATED(D) __declspec(deprecated) D | # define XAPIAN_DEPRECATED(D) __declspec(deprecated) D | |||
# else | # else | |||
# define XAPIAN_DEPRECATED(D) D | # define XAPIAN_DEPRECATED(D) D | |||
# endif | # endif | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 7 lines changed or added | |||
document.h | document.h | |||
---|---|---|---|---|
/** \file document.h | /** \file document.h | |||
* \brief API for working with documents | * \brief API for working with documents | |||
*/ | */ | |||
/* Copyright 1999,2000,2001 BrightStation PLC | /* Copyright 1999,2000,2001 BrightStation PLC | |||
* Copyright 2002 Ananova Ltd | * Copyright 2002 Ananova Ltd | |||
* Copyright 2002,2003,2004,2006,2007,2009,2010 Olly Betts | * Copyright 2002,2003,2004,2006,2007,2009 Olly Betts | |||
* Copyright 2009 Lemur Consulting Ltd | ||||
* | * | |||
* 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 32 | skipping to change at line 33 | |||
*/ | */ | |||
#ifndef XAPIAN_INCLUDED_DOCUMENT_H | #ifndef XAPIAN_INCLUDED_DOCUMENT_H | |||
#define XAPIAN_INCLUDED_DOCUMENT_H | #define XAPIAN_INCLUDED_DOCUMENT_H | |||
#include <string> | #include <string> | |||
#include <xapian/base.h> | #include <xapian/base.h> | |||
#include <xapian/types.h> | #include <xapian/types.h> | |||
#include <xapian/termiterator.h> | #include <xapian/termiterator.h> | |||
#include <xapian/valueiterator.h> | ||||
#include <xapian/visibility.h> | #include <xapian/visibility.h> | |||
namespace Xapian { | namespace Xapian { | |||
class ValueIterator; | /// A document in the database - holds data, values, terms, and postings | |||
/** A handle representing a document in a Xapian database. | ||||
* | ||||
* The Document class fetches information from the database lazily. Usual | ||||
ly | ||||
* this behaviour isn't visible to users (except for the speed benefits), | ||||
but | ||||
* if the document in the database is modified or deleted, then preexistin | ||||
g | ||||
* Document objects may return the old or new versions of data (or throw | ||||
* Xapian::DocNotFoundError in the case of deletion). | ||||
* | ||||
* Since Database objects work on a snapshot of the database's state, the | ||||
* situation above can only happen with a WritableDatabase object, or if | ||||
* you call Database::reopen() on a Database object. | ||||
* | ||||
* We recommend you avoid designs where this behaviour is an issue. | ||||
*/ | ||||
class XAPIAN_VISIBILITY_DEFAULT Document { | class XAPIAN_VISIBILITY_DEFAULT Document { | |||
public: | public: | |||
class Internal; | class Internal; | |||
/// @private @internal Reference counted internals. | /// @private @internal Reference counted internals. | |||
Xapian::Internal::RefCntPtr<Internal> internal; | Xapian::Internal::RefCntPtr<Internal> internal; | |||
/** @private @internal Constructor is only used by internal classes. | /** @private @internal Constructor is only used by internal classes. | |||
* | * | |||
* @param internal_ pointer to internal opaque class | * @param internal_ pointer to internal opaque class | |||
*/ | */ | |||
skipping to change at line 138 | skipping to change at line 125 | |||
Xapian::termpos tpos, | Xapian::termpos tpos, | |||
Xapian::termcount wdfinc = 1); | Xapian::termcount wdfinc = 1); | |||
/** Add a term to the document, without positional information. | /** Add a term to the document, without positional information. | |||
* | * | |||
* Any existing positional information for the term will be left | * Any existing positional information for the term will be left | |||
* unmodified. | * unmodified. | |||
* | * | |||
* @param tname The name of the term. | * @param tname The name of the term. | |||
* @param wdfinc The increment that will be applied to the wdf | * @param wdfinc The increment that will be applied to the wdf | |||
* for this term (default: 1). | * for this term. | |||
*/ | */ | |||
void add_term(const std::string & tname, Xapian::termcount wdfinc = 1); | void add_term(const std::string & tname, Xapian::termcount wdfinc = 1); | |||
/** Add a boolean filter term to the document. | ||||
* | ||||
* This method adds @a term to the document with wdf of 0 - | ||||
* this is generally what you want for a term used for boolean | ||||
* filtering as the wdf of such terms is ignored, and it doesn't | ||||
* make sense for them to contribute to the document's length. | ||||
* | ||||
* If the specified term already indexes this document, this method | ||||
* has no effect. | ||||
* | ||||
* It is exactly the same as add_term(term, 0). | ||||
* | ||||
* This method was added in Xapian 1.0.18. | ||||
* | ||||
* @param term The term to add. | ||||
*/ | ||||
void add_boolean_term(const std::string & term) { add_term(term, 0); | ||||
} | ||||
/** Remove a posting of a term from the document. | /** Remove a posting of a term from the document. | |||
* | * | |||
* Note that the term will still index the document even if all | * Note that the term will still index the document even if all | |||
* occurrences are removed. To remove a term from a document | * occurrences are removed. To remove a term from a document | |||
* completely, use remove_term(). | * completely, use remove_term(). | |||
* | * | |||
* @param tname The name of the term. | * @param tname The name of the term. | |||
* @param tpos The position of the term. | * @param tpos The position of the term. | |||
* @param wdfdec The decrement that will be applied to the wdf | * @param wdfdec The decrement that will be applied to the wdf | |||
* when removing this posting. The wdf will not g o | * when removing this posting. The wdf will not g o | |||
skipping to change at line 215 | skipping to change at line 184 | |||
return TermIterator(NULL); | return TermIterator(NULL); | |||
} | } | |||
/// Count the values in this document. | /// Count the values in this document. | |||
Xapian::termcount values_count() const; | Xapian::termcount values_count() const; | |||
/// Iterator for the values in this document. | /// Iterator for the values in this document. | |||
ValueIterator values_begin() const; | ValueIterator values_begin() const; | |||
/// Equivalent end iterator for values_begin(). | /// Equivalent end iterator for values_begin(). | |||
ValueIterator values_end() const; | ValueIteratorEnd_ values_end() const { | |||
return ValueIteratorEnd_(); | ||||
} | ||||
/** Get the document id which is associated with this document (if a ny). | /** Get the document id which is associated with this document (if a ny). | |||
* | * | |||
* NB If multiple databases are being searched together, then this | * NB If multiple databases are being searched together, then this | |||
* will be the document id in the individual database, not the merg ed | * will be the document id in the individual database, not the merg ed | |||
* database! | * database! | |||
* | * | |||
* @return If this document came from a database, return the docume nt | * @return If this document came from a database, return the docume nt | |||
* id in that database. Otherwise, return 0 (in Xapian | * id in that database. Otherwise, return 0. | |||
* 1.0.22/1.2.4 or later; prior to this the returned value | ||||
was | ||||
* uninitialised). | ||||
*/ | */ | |||
docid get_docid() const; | docid get_docid() const; | |||
/** Serialise document into a string. | ||||
* | ||||
* The document representation may change between Xapian releases: | ||||
* even between minor versions. However, it is guaranteed not to | ||||
* change if the remote database protocol has not changed between | ||||
* releases. | ||||
*/ | ||||
std::string serialise() const; | ||||
/** Unserialise a document from a string produced by serialise(). | ||||
*/ | ||||
static Document unserialise(const std::string &s); | ||||
/// Return a string describing this object. | /// Return a string describing this object. | |||
std::string get_description() const; | std::string get_description() const; | |||
}; | }; | |||
} | } | |||
#endif // XAPIAN_INCLUDED_DOCUMENT_H | #endif // XAPIAN_INCLUDED_DOCUMENT_H | |||
End of changes. 8 change blocks. | ||||
45 lines changed or deleted | 22 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 | |||
positioniterator.h | positioniterator.h | |||
---|---|---|---|---|
skipping to change at line 96 | skipping to change at line 96 | |||
Xapian::termpos operator *() const; | Xapian::termpos operator *() const; | |||
PositionIterator & operator++(); | PositionIterator & operator++(); | |||
TermPosWrapper operator++(int) { | TermPosWrapper operator++(int) { | |||
Xapian::termpos tmp = **this; | Xapian::termpos tmp = **this; | |||
operator++(); | operator++(); | |||
return TermPosWrapper(tmp); | return TermPosWrapper(tmp); | |||
} | } | |||
/** Advance the iterator to the specified termpos. | // extra method, not required for an input_iterator | |||
* | ||||
* If the specified termpos isn't in the list, position ourselves o | ||||
n the | ||||
* first termpos after it (or at_end() if no greater term positions | ||||
are | ||||
* present). | ||||
*/ | ||||
void skip_to(Xapian::termpos pos); | void skip_to(Xapian::termpos pos); | |||
/// Return a string describing this object. | /// Return a string describing this object. | |||
std::string get_description() const; | std::string get_description() const; | |||
// Allow use as an STL iterator | // Allow use as an STL iterator | |||
typedef std::input_iterator_tag iterator_category; | typedef std::input_iterator_tag iterator_category; | |||
typedef Xapian::termpos value_type; | typedef Xapian::termpos value_type; | |||
typedef Xapian::termpos_diff difference_type; // "om_termposcount" | typedef Xapian::termpos_diff difference_type; // "om_termposcount" | |||
typedef Xapian::termpos * pointer; | typedef Xapian::termpos * pointer; | |||
End of changes. 1 change blocks. | ||||
8 lines changed or deleted | 1 lines changed or added | |||
postingiterator.h | postingiterator.h | |||
---|---|---|---|---|
/** \file postingiterator.h | /** \file postingiterator.h | |||
* \brief Classes for iterating through posting lists | * \brief Classes for iterating through posting lists | |||
*/ | */ | |||
/* Copyright 1999,2000,2001 BrightStation PLC | /* Copyright 1999,2000,2001 BrightStation PLC | |||
* Copyright 2002 Ananova Ltd | * Copyright 2002 Ananova Ltd | |||
* Copyright 2003,2004,2005,2007 Olly Betts | * Copyright 2003,2004,2005,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 91 | skipping to change at line 91 | |||
void operator=(const PostingIterator &other); | void operator=(const PostingIterator &other); | |||
PostingIterator & operator++(); | PostingIterator & operator++(); | |||
DocIDWrapper operator++(int) { | DocIDWrapper operator++(int) { | |||
Xapian::docid tmp = **this; | Xapian::docid tmp = **this; | |||
operator++(); | operator++(); | |||
return DocIDWrapper(tmp); | return DocIDWrapper(tmp); | |||
} | } | |||
/** Advance the iterator to the specified docid. | /** Skip the iterator to document did, or the first document after d | |||
* | id | |||
* If the specified docid isn't in the list, position ourselves on | * if did isn't in the list of documents being iterated. | |||
the | ||||
* first document after it (or at_end() if no greater docids are | ||||
* present). | ||||
*/ | */ | |||
void skip_to(Xapian::docid did); | void skip_to(Xapian::docid did); | |||
// Get the weight of the posting at the current position: will | ||||
// need to set a weight object for this to work. | ||||
// Xapian::weight get_weight() const; | ||||
/// Get the document id at the current position in the postlist. | /// Get the document id at the current position in the postlist. | |||
Xapian::docid operator *() const; | Xapian::docid operator *() const; | |||
/** Get the length of the document at the current position in the | /** Get the length of the document at the current position in the | |||
* postlist. | * postlist. | |||
* | * | |||
* This information may be stored in the postlist, in which case | * This information may be stored in the postlist, in which case | |||
* this lookup should be extremely fast (indeed, not require furthe r | * this lookup should be extremely fast (indeed, not require furthe r | |||
* disk access). If the information is not present in the postlist , | * disk access). If the information is not present in the postlist , | |||
* it will be retrieved from the database, at a greater performance | * it will be retrieved from the database, at a greater performance | |||
* cost. | * cost. | |||
*/ | */ | |||
Xapian::doclength get_doclength() const; | Xapian::termcount get_doclength() const; | |||
/** Get the within document frequency of the document at the | /** Get the within document frequency of the document at the | |||
* current position in the postlist. | * current position in the postlist. | |||
*/ | */ | |||
Xapian::termcount get_wdf() const; | Xapian::termcount get_wdf() const; | |||
/** Return PositionIterator pointing to start of positionlist for | /** Return PositionIterator pointing to start of positionlist for | |||
* current document. | * current document. | |||
*/ | */ | |||
PositionIterator positionlist_begin() const; | PositionIterator positionlist_begin() const; | |||
End of changes. 4 change blocks. | ||||
12 lines changed or deleted | 5 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 | |||
stem.h | stem.h | |||
---|---|---|---|---|
skipping to change at line 69 | skipping to change at line 69 | |||
* - none - don't stem terms | * - none - don't stem terms | |||
* - danish (da) | * - danish (da) | |||
* - dutch (nl) | * - dutch (nl) | |||
* - english (en) - Martin Porter's 2002 revision of his stemmer | * - english (en) - Martin Porter's 2002 revision of his stemmer | |||
* - english_lovins (lovins) - Lovin's stemmer | * - english_lovins (lovins) - Lovin's stemmer | |||
* - english_porter (porter) - Porter's stemmer as described in | * - english_porter (porter) - Porter's stemmer as described in | |||
* his 1980 paper | * his 1980 paper | |||
* - finnish (fi) | * - finnish (fi) | |||
* - french (fr) | * - french (fr) | |||
* - german (de) | * - german (de) | |||
* - german2 - Normalises umlauts and ß | ||||
* - hungarian (hu) | ||||
* - italian (it) | * - italian (it) | |||
* - kraaij_pohlmann - A different Dutch stemmer | * - norwegian (no) | |||
* - norwegian (nb, nn, no) | ||||
* - portuguese (pt) | * - portuguese (pt) | |||
* - romanian (ro) | ||||
* - russian (ru) | * - russian (ru) | |||
* - spanish (es) | * - spanish (es) | |||
* - swedish (sv) | * - swedish (sv) | |||
* - turkish (tr) | ||||
* | * | |||
* @exception Xapian::InvalidArgumentError is thrown if | * @exception Xapian::InvalidArgumentError is thrown if | |||
* language isn't recognised. | * language isn't recognised. | |||
*/ | */ | |||
explicit Stem(const std::string &language); | explicit Stem(const std::string &language); | |||
/// Destructor. | /// Destructor. | |||
~Stem(); | ~Stem(); | |||
/** Stem a word. | /** Stem a word. | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 1 lines changed or added | |||
termgenerator.h | termgenerator.h | |||
---|---|---|---|---|
/** @file termgenerator.h | /** @file termgenerator.h | |||
* @brief parse free text and generate terms | * @brief parse free text and generate terms | |||
*/ | */ | |||
/* Copyright (C) 2007 Olly Betts | /* Copyright (C) 2007,2009 Olly Betts | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (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 66 | skipping to change at line 66 | |||
/// Default constructor. | /// Default constructor. | |||
TermGenerator(); | TermGenerator(); | |||
/// Destructor. | /// Destructor. | |||
~TermGenerator(); | ~TermGenerator(); | |||
/// Set the Xapian::Stem object to be used for generating stemmed terms . | /// Set the Xapian::Stem object to be used for generating stemmed terms . | |||
void set_stemmer(const Xapian::Stem & stemmer); | void set_stemmer(const Xapian::Stem & stemmer); | |||
/** Set the Xapian::Stopper object to be used for identifying stopwords | /// Set the Xapian::Stopper object to be used for identifying stopwords | |||
. | . | |||
* | ||||
* Stemmed forms of stopwords aren't indexed, but unstemmed forms stil | ||||
l | ||||
* are so that searches for phrases including stop words still work. | ||||
*/ | ||||
void set_stopper(const Xapian::Stopper *stop = NULL); | void set_stopper(const Xapian::Stopper *stop = NULL); | |||
/// Set the current document. | /// Set the current document. | |||
void set_document(const Xapian::Document & doc); | void set_document(const Xapian::Document & doc); | |||
/// Get the current document. | /// Get the current document. | |||
const Xapian::Document & get_document() const; | const Xapian::Document & get_document() const; | |||
/// Set the database to index spelling data to. | /// Set the database to index spelling data to. | |||
void set_database(const Xapian::WritableDatabase &db); | void set_database(const Xapian::WritableDatabase &db); | |||
skipping to change at line 109 | skipping to change at line 105 | |||
*/ | */ | |||
flags set_flags(flags toggle, flags mask = flags(0)); | flags set_flags(flags toggle, flags mask = flags(0)); | |||
/** Index some text. | /** Index some text. | |||
* | * | |||
* @param weight The wdf increment (default 1). | * @param weight The wdf increment (default 1). | |||
* @param prefix The term prefix to use (default is no prefix). | * @param prefix The term prefix to use (default is no prefix). | |||
*/ | */ | |||
void index_text(const Xapian::Utf8Iterator & itor, | void index_text(const Xapian::Utf8Iterator & itor, | |||
Xapian::termcount weight = 1, | Xapian::termcount weight = 1, | |||
const std::string & prefix = ""); | const std::string & prefix = std::string()); | |||
/** Index some text in a std::string. | /** Index some text in a std::string. | |||
* | * | |||
* @param weight The wdf increment (default 1). | * @param weight The wdf increment (default 1). | |||
* @param prefix The term prefix to use (default is no prefix). | * @param prefix The term prefix to use (default is no prefix). | |||
*/ | */ | |||
void index_text(const std::string & text, | void index_text(const std::string & text, | |||
Xapian::termcount weight = 1, | Xapian::termcount weight = 1, | |||
const std::string & prefix = "") { | const std::string & prefix = std::string()) { | |||
return index_text(Utf8Iterator(text), weight, prefix); | return index_text(Utf8Iterator(text), weight, prefix); | |||
} | } | |||
/** Index some text without positional information. | /** Index some text without positional information. | |||
* | * | |||
* Just like index_text, but no positional information is generated. T his | * Just like index_text, but no positional information is generated. T his | |||
* means that the database will be significantly smaller, but that phra se | * means that the database will be significantly smaller, but that phra se | |||
* searching and NEAR won't be supported. | * searching and NEAR won't be supported. | |||
*/ | */ | |||
void index_text_without_positions(const Xapian::Utf8Iterator & itor, | void index_text_without_positions(const Xapian::Utf8Iterator & itor, | |||
Xapian::termcount weight = 1, | Xapian::termcount weight = 1, | |||
const std::string & prefix = ""); | const std::string & prefix = std::stri ng()); | |||
/** Index some text in a std::string without positional information. | /** Index some text in a std::string without positional information. | |||
* | * | |||
* Just like index_text, but no positional information is generated. T his | * Just like index_text, but no positional information is generated. T his | |||
* means that the database will be significantly smaller, but that phra se | * means that the database will be significantly smaller, but that phra se | |||
* searching and NEAR won't be supported. | * searching and NEAR won't be supported. | |||
*/ | */ | |||
void index_text_without_positions(const std::string & text, | void index_text_without_positions(const std::string & text, | |||
Xapian::termcount weight = 1, | Xapian::termcount weight = 1, | |||
const std::string & prefix = "") { | const std::string & prefix = std::stri ng()) { | |||
return index_text_without_positions(Utf8Iterator(text), weight, pref ix); | return index_text_without_positions(Utf8Iterator(text), weight, pref ix); | |||
} | } | |||
/** Increase the termpos used by index_text by @a delta. | /** Increase the termpos used by index_text by @a delta. | |||
* | * | |||
* This can be used to prevent phrase searches from spanning two | * This can be used to prevent phrase searches from spanning two | |||
* unconnected blocks of text (e.g. the title and body text). | * unconnected blocks of text (e.g. the title and body text). | |||
*/ | */ | |||
void increase_termpos(Xapian::termcount delta = 100); | void increase_termpos(Xapian::termcount delta = 100); | |||
End of changes. 6 change blocks. | ||||
12 lines changed or deleted | 7 lines changed or added | |||
termiterator.h | termiterator.h | |||
---|---|---|---|---|
/** \file termiterator.h | /** \file termiterator.h | |||
* \brief Classes for iterating through term lists | * \brief Classes for iterating through term lists | |||
*/ | */ | |||
/* Copyright 1999,2000,2001 BrightStation PLC | /* Copyright 1999,2000,2001 BrightStation PLC | |||
* Copyright 2002 Ananova Ltd | * Copyright 2002 Ananova Ltd | |||
* Copyright 2003,2004,2005,2006,2007 Olly Betts | * Copyright 2003,2004,2005,2006,2007,2008 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 31 | skipping to change at line 31 | |||
* USA | * USA | |||
*/ | */ | |||
#ifndef XAPIAN_INCLUDED_TERMITERATOR_H | #ifndef XAPIAN_INCLUDED_TERMITERATOR_H | |||
#define XAPIAN_INCLUDED_TERMITERATOR_H | #define XAPIAN_INCLUDED_TERMITERATOR_H | |||
#include <iterator> | #include <iterator> | |||
#include <string> | #include <string> | |||
#include <xapian/base.h> | #include <xapian/base.h> | |||
#include <xapian/derefwrapper.h> | ||||
#include <xapian/types.h> | #include <xapian/types.h> | |||
#include <xapian/positioniterator.h> | #include <xapian/positioniterator.h> | |||
#include <xapian/visibility.h> | #include <xapian/visibility.h> | |||
namespace Xapian { | namespace Xapian { | |||
class Database; | class Database; | |||
/** @internal A wrapper class for a termname which returns the termname if | ||||
* dereferenced with *. We need this to implement input_iterator semantic | ||||
s. | ||||
*/ | ||||
class TermNameWrapper { | ||||
private: | ||||
std::string tname; | ||||
public: | ||||
explicit TermNameWrapper(const std::string & tname_) : tname(tname_) | ||||
{ } | ||||
const std::string & operator*() const { return tname; } | ||||
}; | ||||
/** An iterator pointing to items in a list of terms. | /** An iterator pointing to items in a list of terms. | |||
*/ | */ | |||
class XAPIAN_VISIBILITY_DEFAULT TermIterator { | class XAPIAN_VISIBILITY_DEFAULT TermIterator { | |||
public: | public: | |||
class Internal; | class Internal; | |||
/// @internal Reference counted internals. | /// @internal Reference counted internals. | |||
Xapian::Internal::RefCntPtr<Internal> internal; | Xapian::Internal::RefCntPtr<Internal> internal; | |||
/// @internal Reference counted internals. | /// @internal Reference counted internals. | |||
explicit TermIterator(Internal *internal_); | explicit TermIterator(Internal *internal_); | |||
skipping to change at line 82 | skipping to change at line 72 | |||
/** Assignment is allowed. The internals are reference counted, | /** Assignment is allowed. The internals are reference counted, | |||
* so assignment is also cheap. | * so assignment is also cheap. | |||
*/ | */ | |||
void operator=(const TermIterator &other); | void operator=(const TermIterator &other); | |||
/// Return the current term. | /// Return the current term. | |||
std::string operator *() const; | std::string operator *() const; | |||
TermIterator & operator++(); | TermIterator & operator++(); | |||
TermNameWrapper operator++(int) { | DerefStringWrapper_ operator++(int) { | |||
std::string tmp = **this; | std::string term(**this); | |||
operator++(); | operator++(); | |||
return TermNameWrapper(tmp); | return DerefStringWrapper_(term); | |||
} | } | |||
/** Advance the iterator to the specified term. | /** Skip the iterator to term tname, or the first term after tname | |||
* | * if tname isn't in the list of terms being iterated. | |||
* If the specified term isn't in the list, position ourselves on t | ||||
he | ||||
* first term after it (or at_end() if no greater terms are present | ||||
). | ||||
*/ | */ | |||
void skip_to(const std::string & tname); | void skip_to(const std::string & tname); | |||
/** Return the wdf of the current term (if meaningful). | /** Return the wdf of the current term (if meaningful). | |||
* | * | |||
* The wdf (within document frequency) is the number of occurences | * The wdf (within document frequency) is the number of occurences | |||
* of a term in a particular document. | * of a term in a particular document. | |||
*/ | */ | |||
Xapian::termcount get_wdf() const; | Xapian::termcount get_wdf() const; | |||
skipping to change at line 137 | skipping to change at line 125 | |||
/// Allow use as an STL iterator | /// Allow use as an STL iterator | |||
//@{ | //@{ | |||
typedef std::input_iterator_tag iterator_category; | typedef std::input_iterator_tag iterator_category; | |||
typedef std::string value_type; | typedef std::string value_type; | |||
typedef Xapian::termcount_diff difference_type; | typedef Xapian::termcount_diff difference_type; | |||
typedef std::string * pointer; | typedef std::string * pointer; | |||
typedef std::string & reference; | typedef std::string & reference; | |||
//@} | //@} | |||
}; | }; | |||
/// Equality test for TermIterator objects. | ||||
inline bool | inline bool | |||
operator==(const TermIterator &a, const TermIterator &b) | operator==(const TermIterator &a, const TermIterator &b) | |||
{ | { | |||
return (a.internal.get() == b.internal.get()); | return (a.internal.get() == b.internal.get()); | |||
} | } | |||
/// Inequality test for TermIterator objects. | ||||
inline bool | inline bool | |||
operator!=(const TermIterator &a, const TermIterator &b) | operator!=(const TermIterator &a, const TermIterator &b) | |||
{ | { | |||
return !(a == b); | return !(a == b); | |||
} | } | |||
} | } | |||
#endif /* XAPIAN_INCLUDED_TERMITERATOR_H */ | #endif /* XAPIAN_INCLUDED_TERMITERATOR_H */ | |||
End of changes. 8 change blocks. | ||||
25 lines changed or deleted | 7 lines changed or added | |||
types.h | types.h | |||
---|---|---|---|---|
/** @file xapian/types.h | /** @file xapian/types.h | |||
* @brief typedefs for Xapian | * @brief typedefs for Xapian | |||
*/ | */ | |||
/* Copyright (C) 2007,2010 Olly Betts | /* Copyright (C) 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. | |||
skipping to change at line 81 | skipping to change at line 81 | |||
*/ | */ | |||
typedef unsigned termpos; | typedef unsigned termpos; | |||
/** A signed difference between two term positions. | /** A signed difference between two term positions. | |||
* | * | |||
* This is used by the Xapian classes which are STL containers of position s | * This is used by the Xapian classes which are STL containers of position s | |||
* for "difference_type". | * for "difference_type". | |||
*/ | */ | |||
typedef int termpos_diff; /* FIXME: can overflow. */ | typedef int termpos_diff; /* FIXME: can overflow. */ | |||
/** A timeout value in milliseconds. | /** A timeout value in microseconds. | |||
* | * | |||
* There are 1000 milliseconds in a second, so for example, to set a | * There are 1 million microseconds in a second, so for example, to set a | |||
* timeout of 5 seconds use 5000. | * timeout of 5 seconds use 5000000. | |||
*/ | */ | |||
typedef unsigned timeout; | typedef unsigned timeout; | |||
/** The number for a value slot in a document. | /** The number for a value slot in a document. | |||
* | * | |||
* Any value slot number except Xapian::BAD_VALUENO is valid. | * Any value slot number except Xapian::BAD_VALUENO is valid. | |||
*/ | */ | |||
typedef unsigned valueno; | typedef unsigned valueno; | |||
/** A signed difference between two value slot numbers. | /** A signed difference between two value slot numbers. | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
unicode.h | unicode.h | |||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
/** Return the number of bytes left in the iterator's buffer. */ | /** Return the number of bytes left in the iterator's buffer. */ | |||
size_t left() const { return p ? end - p : 0; } | size_t left() const { return p ? end - p : 0; } | |||
/** Assign a new string to the iterator. | /** Assign a new string to the iterator. | |||
* | * | |||
* The iterator will forget the string it was iterating through, and | * The iterator will forget the string it was iterating through, and | |||
* return characters from the start of the new string when next called . | * return characters from the start of the new string when next called . | |||
* The string is not copied into the iterator, so it must remain valid | * The string is not copied into the iterator, so it must remain valid | |||
* while the iteration is in progress. | * while the iteration is in progress. | |||
* | * | |||
* @param p_ A pointer to the start of the string to read. | * @param p A pointer to the start of the string to read. | |||
* | * | |||
* @param len The length of the string to read. | * @param len The length of the string to read. | |||
*/ | */ | |||
void assign(const char *p_, size_t len) { | void assign(const char *p_, size_t len) { | |||
if (len) { | if (len) { | |||
p = reinterpret_cast<const unsigned char*>(p_); | p = reinterpret_cast<const unsigned char*>(p_); | |||
end = p + len; | end = p + len; | |||
seqlen = 0; | seqlen = 0; | |||
} else { | } else { | |||
p = NULL; | p = NULL; | |||
skipping to change at line 93 | skipping to change at line 93 | |||
* is in progress. | * is in progress. | |||
*/ | */ | |||
void assign(const std::string &s) { assign(s.data(), s.size()); } | void assign(const std::string &s) { assign(s.data(), s.size()); } | |||
/** Create an iterator given a pointer to a null terminated string. | /** Create an iterator given a pointer to a null terminated string. | |||
* | * | |||
* The iterator will return characters from the start of the string wh en | * The iterator will return characters from the start of the string wh en | |||
* next called. The string is not copied into the iterator, so it mus t | * next called. The string is not copied into the iterator, so it mus t | |||
* remain valid while the iteration is in progress. | * remain valid while the iteration is in progress. | |||
* | * | |||
* @param p_ A pointer to the start of the null terminated string to r ead. | * @param p A pointer to the start of the null terminated string to re ad. | |||
*/ | */ | |||
explicit Utf8Iterator(const char *p_); | explicit Utf8Iterator(const char *p_); | |||
/** Create an iterator given a pointer and a length. | /** Create an iterator given a pointer and a length. | |||
* | * | |||
* The iterator will return characters from the start of the string wh en | * The iterator will return characters from the start of the string wh en | |||
* next called. The string is not copied into the iterator, so it mus t | * next called. The string is not copied into the iterator, so it mus t | |||
* remain valid while the iteration is in progress. | * remain valid while the iteration is in progress. | |||
* | * | |||
* @param p_ A pointer to the start of the string to read. | * @param p A pointer to the start of the string to read. | |||
* | * | |||
* @param len The length of the string to read. | * @param len The length of the string to read. | |||
*/ | */ | |||
Utf8Iterator(const char *p_, size_t len) { assign(p_, len); } | Utf8Iterator(const char *p_, size_t len) { assign(p_, len); } | |||
/** Create an iterator given a string. | /** Create an iterator given a string. | |||
* | * | |||
* The iterator will return characters from the start of the string wh en | * The iterator will return characters from the start of the string wh en | |||
* next called. The string is not copied into the iterator, so it mus t | * next called. The string is not copied into the iterator, so it mus t | |||
* remain valid while the iteration is in progress. | * remain valid while the iteration is in progress. | |||
skipping to change at line 182 | skipping to change at line 182 | |||
/// We implement the semantics of an STL input_iterator. | /// We implement the semantics of an STL input_iterator. | |||
//@{ | //@{ | |||
typedef std::input_iterator_tag iterator_category; | typedef std::input_iterator_tag iterator_category; | |||
typedef unsigned value_type; | typedef unsigned value_type; | |||
typedef size_t difference_type; | typedef size_t difference_type; | |||
typedef const unsigned * pointer; | typedef const unsigned * pointer; | |||
typedef const unsigned & reference; | typedef const unsigned & reference; | |||
//@} | //@} | |||
}; | }; | |||
/// Functions associated with handling Unicode characters. | ||||
namespace Unicode { | namespace Unicode { | |||
/** Each Unicode character is in exactly one of these categories. */ | /** Each Unicode character is in exactly one of these categories. */ | |||
typedef enum { | typedef enum { | |||
UNASSIGNED, | UNASSIGNED, | |||
UPPERCASE_LETTER, | UPPERCASE_LETTER, | |||
LOWERCASE_LETTER, | LOWERCASE_LETTER, | |||
TITLECASE_LETTER, | TITLECASE_LETTER, | |||
MODIFIER_LETTER, | MODIFIER_LETTER, | |||
OTHER_LETTER, | OTHER_LETTER, | |||
skipping to change at line 299 | skipping to change at line 298 | |||
} | } | |||
/// Test if a given Unicode character is "word character". | /// Test if a given Unicode character is "word character". | |||
inline bool is_wordchar(unsigned ch) { | inline bool is_wordchar(unsigned ch) { | |||
const unsigned int WORDCHAR_MASK = | const unsigned int WORDCHAR_MASK = | |||
(1 << Xapian::Unicode::UPPERCASE_LETTER) | | (1 << Xapian::Unicode::UPPERCASE_LETTER) | | |||
(1 << Xapian::Unicode::LOWERCASE_LETTER) | | (1 << Xapian::Unicode::LOWERCASE_LETTER) | | |||
(1 << Xapian::Unicode::TITLECASE_LETTER) | | (1 << Xapian::Unicode::TITLECASE_LETTER) | | |||
(1 << Xapian::Unicode::MODIFIER_LETTER) | | (1 << Xapian::Unicode::MODIFIER_LETTER) | | |||
(1 << Xapian::Unicode::OTHER_LETTER) | | (1 << Xapian::Unicode::OTHER_LETTER) | | |||
(1 << Xapian::Unicode::NON_SPACING_MARK) | | ||||
(1 << Xapian::Unicode::DECIMAL_DIGIT_NUMBER) | | (1 << Xapian::Unicode::DECIMAL_DIGIT_NUMBER) | | |||
(1 << Xapian::Unicode::LETTER_NUMBER) | | (1 << Xapian::Unicode::LETTER_NUMBER) | | |||
(1 << Xapian::Unicode::OTHER_NUMBER) | | (1 << Xapian::Unicode::OTHER_NUMBER) | | |||
(1 << Xapian::Unicode::CONNECTOR_PUNCTUATION); | (1 << Xapian::Unicode::CONNECTOR_PUNCTUATION); | |||
return ((WORDCHAR_MASK >> get_category(ch)) & 1); | return ((WORDCHAR_MASK >> get_category(ch)) & 1); | |||
} | } | |||
/// Test if a given Unicode character is a whitespace character. | /// Test if a given Unicode character is a whitespace character. | |||
inline bool is_whitespace(unsigned ch) { | inline bool is_whitespace(unsigned ch) { | |||
const unsigned int WHITESPACE_MASK = | const unsigned int WHITESPACE_MASK = | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 4 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 | |||
version.h | version.h | |||
---|---|---|---|---|
/** @file version.h | // version.h: Define preprocesor symbols for the library version. | |||
* @brief Define preprocesor symbols for the library version | // If using GCC, also check the C++ ABI version is compatible with that use | |||
*/ | d | |||
// Copyright (C) 2002,2004,2005,2006,2007,2009 Olly Betts | // to build the library. | |||
// | ||||
// Copyright (C) 2002,2004,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. | |||
// | // | |||
// 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 USA | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |||
#ifndef XAPIAN_INCLUDED_VERSION_H | #ifndef XAPIAN_INCLUDED_VERSION_H | |||
#define XAPIAN_INCLUDED_VERSION_H | #define XAPIAN_INCLUDED_VERSION_H | |||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0) | ||||
#error Xapian no longer supports GCC < 3.1 | ||||
#else | ||||
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION != 1002 | #if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION != 1002 | |||
#error The C++ ABI version of compiler you are using does not match | #error The C++ ABI version of compiler you are using does not match | |||
#error that of the compiler used to build the library. The versions | #error that of the compiler used to build the library. The versions | |||
#error must match or your program will not work correctly. | #error must match or your program will not work correctly. | |||
#error The Xapian library was built with g++ 4.5.0 | #error The Xapian library was built with g++ 4.5.0 | |||
#endif | #endif | |||
#ifdef _GLIBCXX_DEBUG | #ifdef _GLIBCXX_DEBUG | |||
#error You are compiling with _GLIBCXX_DEBUG defined, but the library | #error You are compiling with _GLIBCXX_DEBUG defined, but the library | |||
#error was not compiled with this flag. The settings must match or your | #error was not compiled with this flag. The settings must match or your | |||
#error program will not work correctly. | #error program will not work correctly. | |||
#endif | #endif | |||
#endif | #endif | |||
#endif | ||||
/// The version of Xapian as a C string literal. | #define XAPIAN_VERSION "1.1.1" | |||
#define XAPIAN_VERSION "1.0.23" | ||||
/** The major component of the Xapian version. | ||||
* E.g. for Xapian 1.0.14 this would be: 1 | ||||
*/ | ||||
#define XAPIAN_MAJOR_VERSION 1 | #define XAPIAN_MAJOR_VERSION 1 | |||
#define XAPIAN_MINOR_VERSION 1 | ||||
#define XAPIAN_REVISION 1 | ||||
/** The minor component of the Xapian version. | #define XAPIAN_HAS_CHERT_BACKEND 1 | |||
* E.g. for Xapian 1.0.14 this would be: 0 | ||||
*/ | ||||
#define XAPIAN_MINOR_VERSION 0 | ||||
/** The revision component of the Xapian version. | ||||
* E.g. for Xapian 1.0.14 this would be: 14 | ||||
*/ | ||||
#define XAPIAN_REVISION 23 | ||||
/// XAPIAN_HAS_FLINT_BACKEND Defined if the flint backend is enabled. | ||||
#define XAPIAN_HAS_FLINT_BACKEND 1 | #define XAPIAN_HAS_FLINT_BACKEND 1 | |||
/// XAPIAN_HAS_QUARTZ_BACKEND Defined if the quartz backend is enabled. | ||||
#define XAPIAN_HAS_QUARTZ_BACKEND 1 | ||||
/// XAPIAN_HAS_INMEMORY_BACKEND Defined if the inmemory backend is enabled. | ||||
#define XAPIAN_HAS_INMEMORY_BACKEND 1 | #define XAPIAN_HAS_INMEMORY_BACKEND 1 | |||
/// XAPIAN_HAS_REMOTE_BACKEND Defined if the remote backend is enabled. | ||||
#define XAPIAN_HAS_REMOTE_BACKEND 1 | #define XAPIAN_HAS_REMOTE_BACKEND 1 | |||
#endif /* XAPIAN_INCLUDED_VERSION_H */ | #endif /* XAPIAN_INCLUDED_VERSION_H */ | |||
End of changes. 8 change blocks. | ||||
28 lines changed or deleted | 14 lines changed or added | |||
visibility.h | visibility.h | |||
---|---|---|---|---|
/** @file visibility.h | // visibility.h: Define XAPIAN_VISIBILITY macro. | |||
* @brief Define XAPIAN_VISIBILITY macro. | // | |||
*/ | ||||
// Copyright (C) 2007 Olly Betts | // Copyright (C) 2007 Olly Betts | |||
// | // | |||
// This program is free software; you can redistribute it and/or modify | // This program is free software; you can redistribute it and/or modify | |||
// it under the terms of the GNU General Public License as published by | // it under the terms of the GNU General Public License as published by | |||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | |||
// (at your option) any later version. | // (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 | |||
End of changes. 1 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added | |||
xapian.h | xapian.h | |||
---|---|---|---|---|
/** @file xapian.h | /** @file xapian.h | |||
* @brief Public interfaces for the Xapian library. | * @brief Public interfaces for the Xapian library. | |||
*/ | */ | |||
// Copyright (C) 2003,2004,2005,2007 Olly Betts | // Copyright (C) 2003,2004,2005,2007,2008,2009 Olly Betts | |||
// | // | |||
// This program is free software; you can redistribute it and/or modify | // This program is free software; you can redistribute it and/or modify | |||
// it under the terms of the GNU General Public License as published by | // it under the terms of the GNU General Public License as published by | |||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | |||
// (at your option) any later version. | // (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 48 | skipping to change at line 48 | |||
#include <xapian/postingiterator.h> | #include <xapian/postingiterator.h> | |||
#include <xapian/termiterator.h> | #include <xapian/termiterator.h> | |||
#include <xapian/valueiterator.h> | #include <xapian/valueiterator.h> | |||
// Indexing | // Indexing | |||
#include <xapian/termgenerator.h> | #include <xapian/termgenerator.h> | |||
// Searching | // Searching | |||
#include <xapian/enquire.h> | #include <xapian/enquire.h> | |||
#include <xapian/expanddecider.h> | #include <xapian/expanddecider.h> | |||
#include <xapian/postingsource.h> | ||||
#include <xapian/query.h> | #include <xapian/query.h> | |||
#include <xapian/queryparser.h> | #include <xapian/queryparser.h> | |||
#include <xapian/sorter.h> | #include <xapian/sorter.h> | |||
#include <xapian/valuesetmatchdecider.h> | ||||
#include <xapian/weight.h> | ||||
// Stemming | // Stemming | |||
#include <xapian/stem.h> | #include <xapian/stem.h> | |||
// Serialisation support | ||||
#include <xapian/serialisationcontext.h> | ||||
// Unicode support | // Unicode support | |||
#include <xapian/unicode.h> | #include <xapian/unicode.h> | |||
// ELF visibility annotations for GCC. | // ELF visibility annotations for GCC. | |||
#include <xapian/visibility.h> | #include <xapian/visibility.h> | |||
#include <xapian/deprecated.h> | ||||
/// The Xapian namespace contains public interfaces for the Xapian library. | ||||
namespace Xapian { | ||||
// Functions returning library version: | // Functions returning library version: | |||
namespace Xapian { | ||||
/** Report the version string of the library which the program is linked wi th. | /** Report the version string of the library which the program is linked wi th. | |||
* | * | |||
* This may be different to the version compiled against (given by | * This may be different to the version compiled against (given by | |||
* XAPIAN_VERSION) if shared libraries are being used. | * XAPIAN_VERSION) if shared libraries are being used. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
const char * version_string(); | const char * version_string(); | |||
/** For compatibility with Xapian 0.9.5 and earlier. | /** Report the major version of the library which the program is linked to. | |||
* | ||||
* @deprecated This function is now deprecated, use Xapian::version_string( | ||||
) | ||||
* instead. | ||||
*/ | ||||
XAPIAN_VISIBILITY_DEFAULT | ||||
XAPIAN_DEPRECATED(const char * xapian_version_string()); | ||||
/** Report the major version of the library which the program is linked wit | ||||
h. | ||||
* | * | |||
* This may be different to the version compiled against (given by | * This may be different to the version compiled against (given by | |||
* XAPIAN_MAJOR_VERSION) if shared libraries are being used. | * XAPIAN_MAJOR_VERSION) if shared libraries are being used. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
int major_version(); | int major_version(); | |||
/** For compatibility with Xapian 0.9.5 and earlier. | /** Report the minor version of the library which the program is linked to. | |||
* | ||||
* @deprecated This function is now deprecated, use Xapian::major_version() | ||||
* instead. | ||||
*/ | ||||
XAPIAN_VISIBILITY_DEFAULT | ||||
XAPIAN_DEPRECATED(int xapian_major_version()); | ||||
/** Report the minor version of the library which the program is linked wit | ||||
h. | ||||
* | * | |||
* This may be different to the version compiled against (given by | * This may be different to the version compiled against (given by | |||
* XAPIAN_MINOR_VERSION) if shared libraries are being used. | * XAPIAN_MINOR_VERSION) if shared libraries are being used. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
int minor_version(); | int minor_version(); | |||
/** For compatibility with Xapian 0.9.5 and earlier. | /** Report the revision of the library which the program is linked to. | |||
* | ||||
* @deprecated This function is now deprecated, use Xapian::minor_version() | ||||
* instead. | ||||
*/ | ||||
XAPIAN_VISIBILITY_DEFAULT | ||||
XAPIAN_DEPRECATED(int xapian_minor_version()); | ||||
/** Report the revision of the library which the program is linked with. | ||||
* | * | |||
* This may be different to the version compiled against (given by | * This may be different to the version compiled against (given by | |||
* XAPIAN_REVISION) if shared libraries are being used. | * XAPIAN_REVISION) if shared libraries are being used. | |||
*/ | */ | |||
XAPIAN_VISIBILITY_DEFAULT | XAPIAN_VISIBILITY_DEFAULT | |||
int revision(); | int revision(); | |||
/** For compatibility with Xapian 0.9.5 and earlier. | ||||
* | ||||
* @deprecated This function is now deprecated, use Xapian::revision() | ||||
* instead. | ||||
*/ | ||||
XAPIAN_VISIBILITY_DEFAULT | ||||
XAPIAN_DEPRECATED(int xapian_revision()); | ||||
} | } | |||
#endif /* XAPIAN_INCLUDED_XAPIAN_H */ | #endif /* XAPIAN_INCLUDED_XAPIAN_H */ | |||
End of changes. 10 change blocks. | ||||
43 lines changed or deleted | 11 lines changed or added | |||