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

OmQuery Class Reference

Class representing a query. More...

#include <omquery.h>

List of all members.

Public Types

enum  op {
  OP_AND, OP_OR, OP_AND_NOT, OP_XOR,
  OP_AND_MAYBE, OP_FILTER, OP_NEAR, OP_PHRASE,
  OP_WEIGHT_CUTOFF, OP_ELITE_SET
}
 Enum of possible query operations. More...


Public Methods

 OmQuery (const OmQuery &copyme)
 Copy constructor. More...

OmQuery & operator= (const OmQuery &copyme)
 Assignment. More...

 OmQuery ()
 Default constructor: makes an undefined query which can't be used directly. More...

 ~OmQuery ()
 Destructor. More...

 OmQuery (const om_termname &tname_, om_termcount wqf_=1, om_termpos term_pos_=0)
 A query consisting of a single term. More...

 OmQuery (OmQuery::op op_, const OmQuery &left, const OmQuery &right)
 A query consisting of two subqueries, opp-ed together. More...

 OmQuery (OmQuery::op op_, const om_termname &left, const om_termname &right)
 A query consisting of two termnames opp-ed together. More...

template<class Iterator>  OmQuery (OmQuery::op op_, Iterator qbegin, Iterator qend)
 A set of OmQuery's, merged together with specified operator. More...

template<class SubQ>  OmQuery (OmQuery::op op_, SubQ q)
 A single OmQuery, modified by a specified operator. More...

void set_window (om_termpos window)
 Set the window size, for a NEAR or PHRASE query. More...

void set_cutoff (om_weight cutoff)
 Set the cutoff parameter, for a WEIGHT_CUTOFF query. More...

void set_elite_set_size (om_termcount size)
 Set the elite set size, for ELITE_SET queries. More...

om_termcount get_length () const
 Get the length of the query, used by some ranking formulae. More...

om_termcount set_length (om_termcount qlen)
 Set the length of the query. More...

OmTermIterator get_terms_begin () const
 Return an OmTermIterator returning all the terms in the query, in order of termpos. More...

OmTermIterator get_terms_end () const
 Return an OmTermIterator to the end of the list of terms in the query. More...

bool is_empty () const
 Test is the query is empty (i.e. was set using OmQuery() or with. More...

std::string get_description () const
 Returns a string representing the query. More...


Public Attributes

Internal * internal


Detailed Description

Class representing a query.

Queries are represented as a hierarchy of classes.


Member Enumeration Documentation

enum OmQuery::op
 

Enum of possible query operations.

Enumeration values:
OP_AND  Return iff both subqueries are satisfied.
OP_OR  Return if either subquery is satisfied.
OP_AND_NOT  Return if left but not right satisfied.
OP_XOR  Return if one query satisfied, but not both.
OP_AND_MAYBE  Return iff left satisfied, but use weights from both.
OP_FILTER  As AND, but use only weights from left subquery.
OP_NEAR  Find occurrences of a list of terms with all the terms occurring within a specified window of positions.

Each occurrence of a term must be at a different position, but the order they appear in is irrelevant.

The window parameter should be specified for this operation, but will default to the number of terms in the list.

OP_PHRASE  Find occurrences of a list of terms with all the terms occurring within a specified window of positions, and all the terms appearing in the order specified.

Each occurrence of a term must be at a different position.

The window parameter should be specified for this operation, but will default to the number of terms in the list.

OP_WEIGHT_CUTOFF  Return only results with a weight greater than or equal to a specified cutoff value.

The cutoff parameter should be specified for this operation, and will default to 0 (no cutoff).

OP_ELITE_SET  Select an elite set of terms from the subqueries, and perform a query with all those terms combined as an OR query.


Constructor & Destructor Documentation

OmQuery::OmQuery const OmQuery &    copyme
 

Copy constructor.

OmQuery::OmQuery  
 

Default constructor: makes an undefined query which can't be used directly.

Such queries should be thought of as placeholders: they are provided merely for convenience.

An exception will be thrown if an attempt is made to run an undefined query, or to use an undefined query when building up a composite query.

OmQuery::~OmQuery  
 

Destructor.

OmQuery::OmQuery const om_termname &    tname_,
om_termcount    wqf_ = 1,
om_termpos    term_pos_ = 0
 

A query consisting of a single term.

OmQuery::OmQuery OmQuery::op    op_,
const OmQuery &    left,
const OmQuery &    right
 

A query consisting of two subqueries, opp-ed together.

OmQuery::OmQuery OmQuery::op    op_,
const om_termname &    left,
const om_termname &    right
[inline]
 

A query consisting of two termnames opp-ed together.

template<class Iterator>
OmQuery::OmQuery OmQuery::op    op_,
Iterator    qbegin,
Iterator    qend
 

A set of OmQuery's, merged together with specified operator.

(Takes begin and end iterators). AND, OR, NEAR and PHRASE can take any number of subqueries. WEIGHT_CUTOFF takes only one subquery. If the operator is anything else then there must be exactly two subqueries.

The iterators may be to any of OmQuery objects, OmQuery pointers, or om_termname objects (ie, strings).

template<class SubQ>
OmQuery::OmQuery OmQuery::op    op_,
SubQ    q
 

A single OmQuery, modified by a specified operator.

The subquery may be any of: an OmQuery object, OmQuery pointer, or om_termname.


Member Function Documentation

std::string OmQuery::get_description   const
 

Returns a string representing the query.

Introspection method.

om_termcount OmQuery::get_length   const
 

Get the length of the query, used by some ranking formulae.

This value is calculated automatically, but may be overridden using set_length().

OmTermIterator OmQuery::get_terms_begin   const
 

Return an OmTermIterator returning all the terms in the query, in order of termpos.

If multiple terms have the same term position, their order is unspecified. Duplicates (same term and termpos) will be removed.

OmTermIterator OmQuery::get_terms_end   const
 

Return an OmTermIterator to the end of the list of terms in the query.

bool OmQuery::is_empty   const
 

Test is the query is empty (i.e. was set using OmQuery() or with.

OmQuery& OmQuery::operator= const OmQuery &    copyme
 

Assignment.

void OmQuery::set_cutoff om_weight    cutoff
 

Set the cutoff parameter, for a WEIGHT_CUTOFF query.

void OmQuery::set_elite_set_size om_termcount    size
 

Set the elite set size, for ELITE_SET queries.

om_termcount OmQuery::set_length om_termcount    qlen
 

Set the length of the query.

This overrides the automatically calculated value, which may be desirable in some situations. Returns the old value of the query length.

void OmQuery::set_window om_termpos    window
 

Set the window size, for a NEAR or PHRASE query.


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.