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

OmDatabase Class Reference

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

#include <omdatabase.h>

Inheritance diagram for OmDatabase:

Inheritance graph
[legend]
List of all members.

Public Methods

void add_database (const OmSettings &params)
 Open a database using the specified parameters, and add it to the databases this object operates over. More...

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

 OmDatabase (const OmSettings &params)
 Open a database. More...

 OmDatabase ()
 Create an OmDatabase with no databases in. More...

virtual ~OmDatabase ()
 Destroy this handle on the database. More...

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

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

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

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

OmPostListIterator postlist_begin (const om_termname &tname) const
 An iterator pointing to the start of the postlist for a given term. More...

OmPostListIterator postlist_end (const om_termname &tname) const
 Corresponding end iterator to postlist_begin(). More...

OmTermIterator termlist_begin (om_docid did) const
 An iterator pointing to the start of the termlist for a given document. More...

OmTermIterator termlist_end (om_docid did) const
 Corresponding end iterator to termlist_begin(). More...

OmPositionListIterator positionlist_begin (om_docid did, const om_termname &tname) const
 An iterator pointing to the start of the position list for a given term in a given document. More...

OmPositionListIterator positionlist_end (om_docid did, const om_termname &tname) const
 Corresponding end iterator to positionlist_begin(). More...

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

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

om_doccount get_doccount () const
 Get the number of documents in the database. More...

om_doclength get_avlength () const
 Get the average length of the documents in the database. More...

om_doccount get_termfreq (const om_termname &tname) const
 Get the number of documents in the database indexed by a given term. More...

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

om_termcount get_collection_freq (const om_termname &tname) const
 Return the total number of occurrences of the given term. More...

om_doclength get_doclength (om_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...

OmDocument get_document (om_docid did) const
 Get a document from the database, given its document id. More...


Public Attributes

Internal * internal

Protected Methods

 OmDatabase (const OmSettings &params, bool readonly)

Detailed Description

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

This class is used in conjunction with an OmEnquire object.

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


Constructor & Destructor Documentation

OmDatabase::OmDatabase const OmSettings   params
 

Open a database.

Parameters:
params  an OmSettings object specifying the parameters to be used to open the database.
Exceptions:
OmInvalidArgumentError  will be thrown if an invalid argument is supplied, for example, an unknown database type.
OmOpeningError  may be thrown if the database cannot be opened.

OmDatabase::OmDatabase  
 

Create an OmDatabase with no databases in.

virtual OmDatabase::~OmDatabase   [virtual]
 

Destroy this handle on the database.

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

OmDatabase::OmDatabase const OmDatabase &    other
 

Copying is allowed.

The internals are reference counted, so copying is cheap.


Member Function Documentation

void OmDatabase::add_database const OmDatabase &    database
 

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

The handle(s) of the database(s) will be copied, so may be deleted or reused by the caller as desired.

Parameters:
database  the database(s) to add.

void OmDatabase::add_database const OmSettings   params
 

Open a database using the specified parameters, and add it to the databases this object operates over.

The database will always be opened read-only.

Parameters:
params  an OmSettings object specifying the parameters to be used to open the database.
Exceptions:
OmInvalidArgumentError  See class documentation.
OmOpeningError  See class documentation.

OmTermIterator OmDatabase::allterms_begin   const
 

An iterator which runs across all terms in the database.

OmTermIterator OmDatabase::allterms_end   const
 

Corresponding end iterator to allterms_begin().

om_doclength OmDatabase::get_avlength   const
 

Get the average length of the documents in the database.

om_termcount OmDatabase::get_collection_freq const om_termname &    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 OmDatabase::get_description   const [virtual]
 

Introspection method.

Returns:
A string describing this object.

Reimplemented in OmWritableDatabase.

om_doccount OmDatabase::get_doccount   const
 

Get the number of documents in the database.

om_doclength OmDatabase::get_doclength om_docid    did const
 

Get the length of a document.

OmDocument OmDatabase::get_document om_docid    did const
 

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

This method returns an OmDocument object which provides the information about a document.

Parameters:
did  The document id for which to retrieve the data.
Returns:
An OmDocument object containing the document data
Exceptions:
OmDocNotFoundError  The document specified could not be found in the database.

om_doccount OmDatabase::get_termfreq const om_termname &    tname const
 

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

void OmDatabase::keep_alive  
 

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

virtual void OmDatabase::operator= const OmDatabase &    other [virtual]
 

Assignment is allowed.

The internals are reference counted, so assignment is cheap.

OmPositionListIterator OmDatabase::positionlist_begin om_docid    did,
const om_termname &    tname
const
 

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

OmPositionListIterator OmDatabase::positionlist_end om_docid    did,
const om_termname &    tname
const
 

Corresponding end iterator to positionlist_begin().

OmPostListIterator OmDatabase::postlist_begin const om_termname &    tname const
 

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

OmPostListIterator OmDatabase::postlist_end const om_termname &    tname const
 

Corresponding end iterator to postlist_begin().

void OmDatabase::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 an OmDatabaseModifiedError.

bool OmDatabase::term_exists const om_termname &    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.

OmTermIterator OmDatabase::termlist_begin om_docid    did const
 

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

OmTermIterator OmDatabase::termlist_end om_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.5.4).
Generated on 16 Oct 2002 by Doxygen 1.2.15.