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

OmEnquire Class Reference

This class provides an interface to the information retrieval system for the purpose of searching. More...

#include <omenquire.h>

List of all members.

Public Methods

 OmEnquire (const OmDatabase &databases, OmErrorHandler *errorhandler_=0)
 Create an OmEnquire object. More...

 ~OmEnquire ()
 Close the OmEnquire object. More...

void set_query (const OmQuery &query_)
 Set the query to run. More...

const OmQueryget_query ()
 Get the query which has been set. More...

OmMSet get_mset (om_doccount first, om_doccount maxitems, const OmRSet *omrset=0, const OmSettings *moptions=0, const OmMatchDecider *mdecider=0) const
 Get (a portion of) the match set for the current query. More...

OmESet get_eset (om_termcount maxitems, const OmRSet &omrset, const OmSettings *eoptions=0, const OmExpandDecider *edecider=0) const
 Get the expand set for the given rset. More...

OmTermIterator get_matching_terms_begin (om_docid did) const
 Get terms which match a given document, by document id. More...

OmTermIterator get_matching_terms_end (om_docid did) const
 End iterator corresponding to get_matching_terms_begin(). More...

OmTermIterator get_matching_terms_begin (const OmMSetIterator &it) const
 Get terms which match a given document, by match set item. More...

OmTermIterator get_matching_terms_end (const OmMSetIterator &it) const
 End iterator corresponding to get_matching_terms_begin(). More...

void register_match_decider (const std::string &name, const OmMatchDecider *mdecider=NULL)
 Register an OmMatchDecider. More...

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


Public Attributes

Internal * internal


Detailed Description

This class provides an interface to the information retrieval system for the purpose of searching.

Databases are usually opened lazily, so exceptions may not be thrown where you would expect them to be. You should catch OmError exceptions when calling any method in OmEnquire.

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


Constructor & Destructor Documentation

OmEnquire::OmEnquire const OmDatabase   databases,
OmErrorHandler   errorhandler_ = 0
 

Create an OmEnquire object.

This specification cannot be changed once the OmEnquire is opened: you must create a new OmEnquire object to access a different database, or set of databases.

Parameters:
database  Specification of the database or databases to use.
errorhandler_  A pointer to the error handler to use. Ownership of the object pointed to is not assumed by the OmEnquire object - the user should delete the OmErrorHandler object after the OmEnquire object is deleted. To use no error handler, this parameter should be 0.

OmEnquire::~OmEnquire  
 

Close the OmEnquire object.

This frees all resources associated with the OmEnquire object, such as handles on the databases used. As a result, any object which refers to these databases, such as an OmDocument, will become invalid after the destruction of the object, and must not be used subsequently.


Member Function Documentation

std::string OmEnquire::get_description   const
 

Introspection method.

Returns:
A string representing the enquire object.

OmESet OmEnquire::get_eset om_termcount    maxitems,
const OmRSet   omrset,
const OmSettings   eoptions = 0,
const OmExpandDecider   edecider = 0
const
 

Get the expand set for the given rset.

Parameters:
maxitems  the maximum number of items to return.
omrset  the relevance set to use when performing the expand operation.
eoptions  options to use when performing the expand.
edecider  a decision functor to use to decide whether a given term should be put in the ESet
Returns:
An OmESet object containing the results of the expand.
Exceptions:
OmInvalidArgumentError  See class documentation.
OmOpeningError  See class documentation.

OmTermIterator OmEnquire::get_matching_terms_begin const OmMSetIterator   it const
 

Get terms which match a given document, by match set item.

This method returns the terms in the current query which match the given document.

If the underlying database has suitable support, using this call (rather than passing an om_docid) will enable the system to ensure that the correct data is returned, and that the document has not been deleted or changed since the query was performed.

Parameters:
it  The iterator for which to retrieve the matching terms.
Returns:
An iterator returning the terms which match the document. The terms will be returned (as far as this makes any sense) in the same order as the terms in the query. Terms will not occur more than once, even if they do in the query.
Exceptions:
OmInvalidArgumentError  See class documentation.
OmOpeningError  See class documentation.
OmDocNotFoundError  The document specified could not be found in the database.

OmTermIterator OmEnquire::get_matching_terms_begin om_docid    did const
 

Get terms which match a given document, by document id.

This method returns the terms in the current query which match the given document.

It is possible for the document to have been removed from the database between the time it is returned in an mset, and the time that this call is made. If possible, you should specify an OmMSetIterator instead of a om_docid, since this will enable database backends with suitable support to prevent this occurring.

Note that a query does not need to have been run in order to make this call.

Parameters:
did  The document id for which to retrieve the matching terms.
Returns:
An iterator returning the terms which match the document. The terms will be returned (as far as this makes any sense) in the same order as the terms in the query. Terms will not occur more than once, even if they do in the query.
Exceptions:
OmInvalidArgumentError  See class documentation.
OmOpeningError  See class documentation.
OmDocNotFoundError  The document specified could not be found in the database.

OmTermIterator OmEnquire::get_matching_terms_end const OmMSetIterator   it const
 

End iterator corresponding to get_matching_terms_begin().

OmTermIterator OmEnquire::get_matching_terms_end om_docid    did const
 

End iterator corresponding to get_matching_terms_begin().

OmMSet OmEnquire::get_mset om_doccount    first,
om_doccount    maxitems,
const OmRSet   omrset = 0,
const OmSettings   moptions = 0,
const OmMatchDecider   mdecider = 0
const
 

Get (a portion of) the match set for the current query.

Parameters:
first  the first item in the result set to return. A value of zero corresponds to the first item returned being that with the highest score. A value of 10 corresponds to the first 10 items being ignored, and the returned items starting at the eleventh.
maxitems  the maximum number of items to return.
omrset  the relevance set to use when performing the query.
moptions  options to use when performing the match.
mdecider  a decision functor to use to decide whether a given document should be put in the MSet
Returns:
An OmMSet object containing the results of the query.
Exceptions:
OmInvalidArgumentError  See class documentation.
OmOpeningError  See class documentation.

const OmQuery& OmEnquire::get_query  
 

Get the query which has been set.

This is only valid after set_query() has been called.

Exceptions:
OmInvalidArgumentError  will be thrown if query has not yet been set.

void OmEnquire::register_match_decider const std::string &    name,
const OmMatchDecider   mdecider = NULL
 

Register an OmMatchDecider.

void OmEnquire::set_query const OmQuery   query_
 

Set the query to run.

Parameters:
query_  the new query to run.
Exceptions:
OmInvalidArgumentError  See class documentation.
OmOpeningError  See class documentation.


The documentation for this class was generated from the following file:
Documentation for Xapian (version 0.5.1).
Generated on 6 Oct 2002 by Doxygen 1.2.15.