Xapian::MSetIterator Class Reference

An iterator pointing to items in an MSet. More...

#include <enquire.h>

Collaboration diagram for Xapian::MSetIterator:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::bidirectional_iterator_tag iterator_category
 Allow use as an STL iterator.
typedef Xapian::docid value_type
typedef Xapian::doccount_diff difference_type
typedef Xapian::docidpointer
typedef Xapian::docidreference

Public Member Functions

 MSetIterator ()
 Create an uninitialised iterator; this cannot be used, but is convenient syntactically.
 ~MSetIterator ()
 MSetIterator (const MSetIterator &other)
 Copying is allowed (and is cheap).
void operator= (const MSetIterator &other)
 Assignment is allowed (and is cheap).
MSetIteratoroperator++ ()
 Advance the iterator.
MSetIterator operator++ (int)
 Advance the iterator (postfix variant).
MSetIteratoroperator-- ()
 Decrement the iterator.
MSetIterator operator-- (int)
 Decrement the iterator (postfix variant).
Xapian::docid operator * () const
 Get the document ID for the current position.
Xapian::Document get_document () const
 Get a Xapian::Document object for the current position.
Xapian::doccount get_rank () const
 Get the rank of the document at the current position.
Xapian::weight get_weight () const
 Get the weight of the document at the current position.
std::string get_collapse_key () const
 Get the collapse key for this document.
Xapian::doccount get_collapse_count () const
 Get an estimate of the number of documents that have been collapsed into this one.
Xapian::percent get_percent () const
 This returns the weight of the document as a percentage score.
std::string get_description () const
 Return a string describing this object.

Private Member Functions

 MSetIterator (Xapian::doccount index_, const MSet &mset_)

Private Attributes

Xapian::doccount index
MSet mset

Friends

class MSet
bool operator== (const MSetIterator &a, const MSetIterator &b)
bool operator!= (const MSetIterator &a, const MSetIterator &b)

Detailed Description

An iterator pointing to items in an MSet.

This is used for access to individual results of a match.

Definition at line 240 of file enquire.h.


Member Typedef Documentation

typedef std::bidirectional_iterator_tag Xapian::MSetIterator::iterator_category

Allow use as an STL iterator.

Definition at line 366 of file enquire.h.

typedef Xapian::docid Xapian::MSetIterator::value_type

Definition at line 367 of file enquire.h.

typedef Xapian::doccount_diff Xapian::MSetIterator::difference_type

Definition at line 368 of file enquire.h.

typedef Xapian::docid* Xapian::MSetIterator::pointer

Definition at line 369 of file enquire.h.

typedef Xapian::docid& Xapian::MSetIterator::reference

Definition at line 370 of file enquire.h.


Constructor & Destructor Documentation

Xapian::MSetIterator::MSetIterator ( Xapian::doccount  index_,
const MSet mset_ 
) [inline, private]

Definition at line 246 of file enquire.h.

Xapian::MSetIterator::MSetIterator (  )  [inline]

Create an uninitialised iterator; this cannot be used, but is convenient syntactically.

Definition at line 256 of file enquire.h.

Xapian::MSetIterator::~MSetIterator (  )  [inline]

Definition at line 258 of file enquire.h.

Xapian::MSetIterator::MSetIterator ( const MSetIterator other  )  [inline]

Copying is allowed (and is cheap).

Definition at line 261 of file enquire.h.

References index, and mset.


Member Function Documentation

void Xapian::MSetIterator::operator= ( const MSetIterator other  )  [inline]

Assignment is allowed (and is cheap).

Definition at line 267 of file enquire.h.

References index, and mset.

MSetIterator& Xapian::MSetIterator::operator++ (  )  [inline]

Advance the iterator.

Definition at line 273 of file enquire.h.

MSetIterator Xapian::MSetIterator::operator++ ( int   )  [inline]

Advance the iterator (postfix variant).

Definition at line 279 of file enquire.h.

MSetIterator& Xapian::MSetIterator::operator-- (  )  [inline]

Decrement the iterator.

Definition at line 286 of file enquire.h.

MSetIterator Xapian::MSetIterator::operator-- ( int   )  [inline]

Decrement the iterator (postfix variant).

Definition at line 292 of file enquire.h.

Xapian::docid Xapian::MSetIterator::operator * (  )  const

Get the document ID for the current position.

Definition at line 565 of file omenquire.cc.

References index, Xapian::MSet::internal, and mset.

Document Xapian::MSetIterator::get_document (  )  const

Get a Xapian::Document object for the current position.

This method returns a Xapian::Document object which provides the information about the document pointed to by the MSetIterator.

If the underlying database has suitable support, using this call (rather than asking the database for a document based on its document ID) 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.

Returns:
A Xapian::Document object containing the document data.
Exceptions:
Xapian::DocNotFoundError The document specified could not be found in the database.

Definition at line 571 of file omenquire.cc.

References index, Xapian::MSet::internal, and mset.

Referenced by DEFINE_TESTCASE().

Xapian::doccount Xapian::MSetIterator::get_rank (  )  const [inline]

Get the rank of the document at the current position.

The rank is the position that this document is at in the ordered list of results of the query. The result is 0-based - i.e. the top-ranked document has a rank of 0.

Definition at line 325 of file enquire.h.

Xapian::weight Xapian::MSetIterator::get_weight (  )  const

Get the weight of the document at the current position.

Definition at line 577 of file omenquire.cc.

References index, Xapian::MSet::internal, and mset.

Referenced by Xapian::MSet::convert_to_percent(), DEFINE_TESTCASE(), get_percent(), mset_range_is_same(), mset_range_is_same_weights(), and print_mset_weights().

std::string Xapian::MSetIterator::get_collapse_key (  )  const

Get the collapse key for this document.

Definition at line 583 of file omenquire.cc.

References index, Xapian::MSet::internal, and mset.

Xapian::doccount Xapian::MSetIterator::get_collapse_count (  )  const

Get an estimate of the number of documents that have been collapsed into this one.

The estimate will always be less than or equal to the actual number of other documents satisfying the match criteria with the same collapse key as this document.

This method may return 0 even though there are other documents with the same collapse key which satisfying the match criteria. However if this method returns non-zero, there definitely are other such documents. So this method may be used to inform the user that there are "at least N other matches in this group", or to control whether to offer a "show other documents in this group" feature (but note that it may not offer it in every case where it would show other documents).

Definition at line 589 of file omenquire.cc.

References index, Xapian::MSet::internal, and mset.

Xapian::percent Xapian::MSetIterator::get_percent (  )  const

This returns the weight of the document as a percentage score.

The return value will be in the range 0 to 100: 0 meaning that the item did not match the query at all.

Definition at line 595 of file omenquire.cc.

References DEBUGAPICALL, get_weight(), Xapian::MSet::internal, mset, and RETURN.

Referenced by DEFINE_TESTCASE(), and mset_range_is_same_percents().

string Xapian::MSetIterator::get_description (  )  const

Return a string describing this object.

Definition at line 602 of file omenquire.cc.

References index, and om_tostring().


Friends And Related Function Documentation

friend class MSet [friend]

Definition at line 242 of file enquire.h.

bool operator== ( const MSetIterator a,
const MSetIterator b 
) [friend]

Definition at line 374 of file enquire.h.

bool operator!= ( const MSetIterator a,
const MSetIterator b 
) [friend]

Definition at line 379 of file enquire.h.


Member Data Documentation

Xapian::doccount Xapian::MSetIterator::index [private]

Definition at line 249 of file enquire.h.

Referenced by Xapian::MSet::fetch(), get_collapse_count(), get_collapse_key(), get_description(), get_document(), get_weight(), MSetIterator(), operator *(), Xapian::operator!=(), operator=(), and Xapian::operator==().

MSet Xapian::MSetIterator::mset [private]

Definition at line 250 of file enquire.h.

Referenced by get_collapse_count(), get_collapse_key(), get_document(), get_percent(), get_weight(), MSetIterator(), operator *(), and operator=().


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.