Xapian::MSetIterator Class Reference

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

## Public Types

typedef std::bidirectional_iterator_tag | iterator_category
| Allow use as an STL iterator.
typedef Xapian::docid | value_type
| Allow use as an STL iterator.
typedef Xapian::doccount_diff | difference_type
| Allow use as an STL iterator.
typedef Xapian::docid * | pointer
| Allow use as an STL iterator.
typedef Xapian::docid & | reference
| Allow use as an STL iterator.

## Public Member Functions

| MSetIterator ()
| Create an uninitialised iterator; this cannot be used, but is convenient syntactically.
| MSetIterator (const MSetIterator &other)
| Copying is allowed (and is cheap).
void | operator= (const MSetIterator &other)
| Assignment is allowed (and is cheap).
MSetIterator & | operator++ ()
| Advance the iterator.
MSetIterator | operator++ (int)
| Advance the iterator (postfix variant).
MSetIterator & | operator-- ()
| 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. More...
Xapian::doccount | get_rank () const
| Get the rank of the document at the current position. More...
double | 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. More...
int | get_percent () const
| This returns the weight of the document as a percentage score. More...
std::string | get_description () const
| Return a string describing this object.

## Friends

bool | operator== (const MSetIterator &a, const MSetIterator &b)
| Equality test for MSetIterator objects.
bool | operator!= (const MSetIterator &a, const MSetIterator &b)
| Inequality test for MSetIterator objects.

## Detailed Description

An iterator pointing to items in an MSet.

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

## Member Function Documentation

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).

Xapian::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.

int Xapian::MSetIterator::get_percent | ( |  | ) | const

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

You probably don't want to show these percentage scores to end users in new applications - they're not really a percentage of anything meaningful, and research seems to suggest that users don't find numeric scores in search results useful.

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

The intention is that the highest weighted document will get 100 if it matches all the weight-contributing terms in the query. However, currently it may get a lower percentage score if you use a MatchDecider and the sorting is primarily by value. In this case, the percentage for a particular document may vary depending on the first, max_size, and checkatleast parameters passed to Enquire::get_mset() (this bug is hard to fix without having to apply the MatchDecider to potentially many more documents, which is potentially costly).

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.

References Xapian::MSet::get_firstitem().

The documentation for this class was generated from the following file:

- xapian/enquire.h