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

Xapian::Database Class Reference

This class is used to access a database, or a set of databases. More...

#include <database.h>

Inheritance diagram for Xapian::Database:

Xapian::WritableDatabase List of all members.

Public Methods

void add_database (const Database &database)
 Add an existing database (or group of databases) to those accessed by this object. More...

 Database ()
 Create a Database with no databases in. More...

 Database (Internal *internal)
virtual ~Database ()
 Destroy this handle on the database. More...

 Database (const Database &other)
 Copying is allowed. More...

virtual void operator= (const Database &other)
 Assignment is allowed. More...

void reopen ()
 Re-open the database. More...

virtual std::string get_description () const
 Introspection method. More...

PostingIterator postlist_begin (const std::string &tname) const
 An iterator pointing to the start of the postlist for a given term. More...

PostingIterator postlist_end (const std::string &tname) const
 Corresponding end iterator to postlist_begin(). More...

TermIterator termlist_begin (Xapian::docid did) const
 An iterator pointing to the start of the termlist for a given document. More...

TermIterator termlist_end (Xapian::docid did) const
 Corresponding end iterator to termlist_begin(). More...

PositionIterator positionlist_begin (Xapian::docid did, const std::string &tname) const
 An iterator pointing to the start of the position list for a given term in a given document. More...

PositionIterator positionlist_end (Xapian::docid did, const std::string &tname) const
 Corresponding end iterator to positionlist_begin(). More...

TermIterator allterms_begin () const
 An iterator which runs across all terms in the database. More...

TermIterator allterms_end () const
 Corresponding end iterator to allterms_begin(). More...

Xapian::doccount get_doccount () const
 Get the number of documents in the database. More...

Xapian::doclength get_avlength () const
 Get the average length of the documents in the database. More...

Xapian::doccount get_termfreq (const std::string &tname) const
 Get the number of documents in the database indexed by a given term. More...

bool term_exists (const std::string &tname) const
 Check if a given term exists in the database. More...

Xapian::termcount get_collection_freq (const std::string &tname) const
 Return the total number of occurrences of the given term. More...

Xapian::doclength get_doclength (Xapian::docid did) const
 Get the length of a document. More...

void keep_alive ()
 Send a "keep-alive" to remote databases to stop them timing out. More...

Xapian::Document get_document (Xapian::docid did) const
 Get a document from the database, given its document id. More...


Public Attributes

std::vector< Xapian::Internal::RefCntPtr<
Internal > > 
internal

Detailed Description

This class is used to access a database, or a set of databases.

This class is used in conjunction with an Enquire object.

Exceptions:
InvalidArgumentError  will be thrown if an invalid argument is supplied, for example, an unknown database type.
DatabaseOpeningError  may be thrown if the database cannot be opened (for example, a required file cannot be found).


Constructor & Destructor Documentation

Xapian::Database::Database  
 

Create a Database with no databases in.

virtual Xapian::Database::~Database   [virtual]
 

Destroy this handle on the database.

If there are no copies of this object remaining, the database will be closed.

Xapian::Database::Database const Database &    other
 

Copying is allowed.

The internals are reference counted, so copying is cheap.


Member Function Documentation

void Xapian::Database::add_database const Database &    database
 

Add an existing database (or group of databases) to those accessed by this object.

Parameters:
database  the database(s) to add.

TermIterator Xapian::Database::allterms_begin   const
 

An iterator which runs across all terms in the database.

TermIterator Xapian::Database::allterms_end   const
 

Corresponding end iterator to allterms_begin().

Xapian::doclength Xapian::Database::get_avlength   const
 

Get the average length of the documents in the database.

Xapian::termcount Xapian::Database::get_collection_freq const std::string &    tname const
 

Return the total number of occurrences of the given term.

This is the sum of the number of ocurrences of the term in each document: ie, the sum of the within document frequencies of the term.

Parameters:
tname  The term whose collection frequency is being requested.

virtual std::string Xapian::Database::get_description   const [virtual]
 

Introspection method.

Returns:
A string describing this object.

Reimplemented in Xapian::WritableDatabase.

Xapian::doccount Xapian::Database::get_doccount   const
 

Get the number of documents in the database.

Xapian::doclength Xapian::Database::get_doclength Xapian::docid    did const
 

Get the length of a document.

Xapian::Document Xapian::Database::get_document Xapian::docid    did const
 

Get a document from the database, given its document id.

This method returns a Xapian::Document object which provides the information about a document.

Parameters:
did  The document id for which to retrieve the data.
Returns:
A Xapian::Document object containing the document data
Exceptions:
Xapian::DocNotFoundError  The document specified could not be found in the database.

Xapian::doccount Xapian::Database::get_termfreq const std::string &    tname const
 

Get the number of documents in the database indexed by a given term.

void Xapian::Database::keep_alive  
 

Send a "keep-alive" to remote databases to stop them timing out.

virtual void Xapian::Database::operator= const Database &    other [virtual]
 

Assignment is allowed.

The internals are reference counted, so assignment is cheap.

PositionIterator Xapian::Database::positionlist_begin Xapian::docid    did,
const std::string &    tname
const
 

An iterator pointing to the start of the position list for a given term in a given document.

PositionIterator Xapian::Database::positionlist_end Xapian::docid    did,
const std::string &    tname
const
 

Corresponding end iterator to positionlist_begin().

PostingIterator Xapian::Database::postlist_begin const std::string &    tname const
 

An iterator pointing to the start of the postlist for a given term.

PostingIterator Xapian::Database::postlist_end const std::string &    tname const
 

Corresponding end iterator to postlist_begin().

void Xapian::Database::reopen  
 

Re-open the database.

This re-opens the database(s) to the latest available version(s). It can be used either to make sure the latest results are returned, or to recover from a Xapian::DatabaseModifiedError.

bool Xapian::Database::term_exists const std::string &    tname const
 

Check if a given term exists in the database.

Return true if and only if the term exists in the database. This is the same as (get_termfreq(tname) != 0), but will often be more efficient.

TermIterator Xapian::Database::termlist_begin Xapian::docid    did const
 

An iterator pointing to the start of the termlist for a given document.

TermIterator Xapian::Database::termlist_end Xapian::docid    did const
 

Corresponding end iterator to termlist_begin().


The documentation for this class was generated from the following file:
Documentation for Xapian (version 0.6.5).
Generated on 4 Jul 2003 by Doxygen 1.2.15.