|
xapian-core
2.0.0
|
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. | |
Iterator over a Xapian::MSet.
| 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.
| 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.
|
inline |
Convert the weight of the current iterator position to a percentage.
If the weighting scheme gives everything zero weight (like Xapian::BoolWeight does) then all results will score 100%.
Otherwise the percentage is calculated as a linear scaling of the relevance weight, with the scale factor determined by the matching document with the highest weight. This result scores 100% if it matches all the weighted query terms, and proportionally less if it only matches some.
The returned percentage is an integer. If the calculated percentage before rounding is non-zero but less than 1% it is rounded up to 1% so that a result scoring 0% means it has zero weight.
Similarly, percentages over 99% but less than 100% are always rounded down, so a result scoring 100% means it matches all weighted query terms.
Note that these generally aren't percentages of anything meaningful (unless you use a custom weighting formula where they are!) but like the weights they are based on, higher values should indicate more relevant results.
References get_weight().
|
inline |
Return the MSet rank for the current position.
The rank of mset[0] is mset.get_firstitem().
| 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.
|
inline |
Return the iterator incremented by n positions.
If n is negative, decrements by (-n) positions.
|
inline |
Return the iterator decremented by n positions.
If n is negative, increments by (-n) positions.