Xapian::MSetIterator Class Reference

Iterator over a Xapian::MSet. More...

`#include <mset.h>`

## Public Member Functions

| MSetIterator ()
| Create an unpositioned MSetIterator.
Xapian::docid | operator* () const
| Get the numeric document id for the current position.
MSetIterator & | operator++ ()
| Advance the iterator to the next position.
MSetIterator | operator++ (int)
| Advance the iterator to the next position (postfix version).
MSetIterator & | operator-- ()
| Move the iterator to the previous position.
MSetIterator | operator-- (int)
| Move the iterator to the previous position (postfix version).
MSetIterator & | operator+= (difference_type n)
| Move the iterator forwards by n positions.
MSetIterator & | operator-= (difference_type n)
| Move the iterator back by n positions.
MSetIterator | operator+ (difference_type n) const
| Return the iterator incremented by n positions.
MSetIterator | operator- (difference_type n) const
| Return the iterator decremented by n positions.
difference_type | operator- (const MSetIterator &o) const
| Return the number of positions between o and this iterator.
Xapian::doccount | get_rank () const
| Return the MSet rank for the current position.
Xapian::Document | get_document () const
| Get the Document object for the current position.
double | get_weight () const
| Get the weight for the current position.
std::string | get_collapse_key () const
| Return the collapse key for the current position.
Xapian::doccount | get_collapse_count () const
| Return a count of the number of collapses done onto the current key.
std::string | get_sort_key () const
| Return the sort key for the current position.
int | get_percent () const
| Convert the weight of the current iterator position to a percentage.
std::string | get_description () const
| Return a string describing this object.

## Detailed Description

Iterator over a Xapian::MSet.

## Member Function Documentation

## get_collapse_count()

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

Return a count of the number of collapses done onto the current key.

This starts at 0, and is incremented each time an item is eliminated because its key is the same as that of the current item (as returned by get_collapse_key()).

Note that this is NOT necessarily one less than the total number of matching documents with this collapse key due to various optimisations implemented in the matcher - for example, it can skip documents completely if it can prove their weight wouldn't be enough to make the result set.

You can say is that if get_collapse_count() > 0 then there are >= get_collapse_count() other documents with the current collapse key. But if get_collapse_count() == 0 then there may or may not be other such documents.

## get_collapse_key()

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

Return the collapse key for the current position.

If collapsing isn't in use, an empty string will be returned.

## get_percent()

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

inline

Convert the weight of the current iterator position to a percentage.

The matching document with the highest weight will get 100% if it matches all the weighted query terms, and proportionally less if it only matches some, and other weights are scaled by the same factor.

Documents with a non-zero score will always score at least 1%.

Note that these generally aren't percentages of anything meaningful (unless you use a custom weighting formula where they are!)

References Xapian::MSet::convert_to_percent().

## get_rank()

Xapian::doccount Xapian::MSetIterator::get_rank | ( |  | ) | const

inline

Return the MSet rank for the current position.

The rank of mset[0] is mset.get_firstitem().

References Xapian::MSet::get_firstitem(), and Xapian::MSet::size().

## get_sort_key()

std::string Xapian::MSetIterator::get_sort_key | ( |  | ) | const

Return the sort key for the current position.

If sorting didn't use a key then an empty string will be returned.

Since
  Added in Xapian 1.4.6.

## operator+()

MSetIterator Xapian::MSetIterator::operator+ | ( | difference_type | n | ) | const

inline

Return the iterator incremented by n positions.

If n is negative, decrements by (-n) positions.

## operator-()

MSetIterator Xapian::MSetIterator::operator- | ( | difference_type | n | ) | const

inline

Return the iterator decremented by n positions.

If n is negative, increments by (-n) positions.

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

- xapian/mset.h