Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

include/xapian/database.h

Go to the documentation of this file.
00001 
00025 #ifndef XAPIAN_INCLUDED_DATABASE_H
00026 #define XAPIAN_INCLUDED_DATABASE_H
00027 
00028 namespace Xapian {
00029 
00030 class Document;
00031 class PostListIterator;
00032 class TermIterator;
00033 class PositionListIterator;
00034 
00035 class WritableDatabase;
00036 
00047 class Database {
00048   public:
00057     void add_database(const Database & database);
00058 
00061     Database();
00062 
00065     Database(Database::Internal *internal);
00066 
00071     virtual ~Database();
00072 
00076     Database(const Database &other);
00077 
00081     virtual void operator=(const Database &other);
00082 
00088     void reopen();
00089 
00094     virtual std::string get_description() const;
00095 
00099     PostListIterator postlist_begin(const termname &tname) const;
00100 
00103     PostListIterator postlist_end(const termname &tname) const;
00104 
00108     TermIterator termlist_begin(docid did) const;
00109     
00112     TermIterator termlist_end(docid did) const;
00113 
00117     PositionListIterator positionlist_begin(docid did, const termname &tname) const;
00118 
00121     PositionListIterator positionlist_end(docid did, const termname &tname) const;
00122 
00125     TermIterator allterms_begin() const;
00126 
00129     TermIterator allterms_end() const;
00130 
00132     doccount get_doccount() const;
00133     
00135     doclength get_avlength() const;
00136 
00138     doccount get_termfreq(const termname & tname) const;
00139 
00146     bool term_exists(const termname & tname) const;
00147 
00157     termcount get_collection_freq(const termname & tname) const;
00158 
00161     doclength get_doclength(docid did) const;
00162 
00166     void keep_alive();
00167 
00180     Document get_document(docid did) const;
00181 };
00182 
00185 class WritableDatabase : public Database {
00186   public:
00193     virtual ~WritableDatabase();
00194 
00197     WritableDatabase();
00198 
00201     WritableDatabase(Database::Internal *internal);
00202 
00206     WritableDatabase(const WritableDatabase &other);
00207 
00215     void operator=(const WritableDatabase &other);
00216 
00258     void flush();
00259 
00282     void begin_transaction();
00283 
00310     void commit_transaction();
00311 
00330     void cancel_transaction();
00331 
00361     docid add_document(const Document & document);
00362 
00365     // FIXME: document more.
00366     void delete_document(docid did);
00367 
00370     // FIXME: document more.
00371     void replace_document(docid did, const Document & document);
00372 
00377     std::string get_description() const;
00378 };
00379 
00380 const int OM_DB_CREATE_OR_OPEN = 1;
00381 const int OM_DB_CREATE = 2;
00382 const int OM_DB_CREATE_OR_OVERWRITE = 3;
00383 const int OM_DB_OPEN = 4;
00384 // Can't see any sensible use for this one
00385 // const int OM_DB_OVERWRITE = XXX;
00386 
00387 /* It's mostly harmless to provide prototypes for all the backends, even
00388  * if they may not all be built in - it means the failure will be at
00389  * link time rather than when a file is built.  The main benefit is
00390  * simplicity, but this also allows us to easily split the backends into
00391  * separate libraries and link the ones we actually use in an application.
00392  */
00393 
00399 Database Auto__open(const std::string &path);
00400 
00411 WritableDatabase Auto__open(const std::string &path, int action);
00412 
00417 Database Quartz__open(const std::string &dir);
00418 
00433 WritableDatabase
00434 Quartz__open(const std::string &dir, int action, int block_size = 8192);
00435 
00438 WritableDatabase InMemory__open();
00439 
00449 Database Muscat36DA__open(const std::string &R, const std::string &T, bool heavy_duty = true);
00450 
00461 Database Muscat36DA__open(const std::string &R, const std::string &T, const std::string &values, bool heavy_duty = true);
00462 
00471 Database Muscat36DB__open(const std::string &DB, size_t cache_size = 30);
00472 
00482 Database Muscat36DB__open(const std::string &DB, const std::string &values = "", size_t cache_size = 30);
00483 
00496 Database Remote__open(const std::string &program, const std::string &args,
00497         unsigned int timeout = 10000);
00498 
00515 Database
00516 Remote__open(const std::string &host, unsigned int port,
00517         unsigned int timeout = 10000, unsigned int connect_timeout = 0);
00518 
00526 Database
00527 Stub__open(const std::string &file);
00528 
00529 };
00530 
00531 #endif

Documentation for Xapian (version 0.6.3).
Generated on 24 Dec 2002 by Doxygen 1.2.15.