xapian-core
1.4.27
|
Iterator over a Xapian::MSet. More...
#include <mset.h>
Public Member Functions | |
MSetIterator () | |
Create an unpositioned MSetIterator. More... | |
Xapian::docid | operator* () const |
Get the numeric document id for the current position. More... | |
MSetIterator & | operator++ () |
Advance the iterator to the next position. More... | |
MSetIterator | operator++ (int) |
Advance the iterator to the next position (postfix version). More... | |
MSetIterator & | operator-- () |
Move the iterator to the previous position. More... | |
MSetIterator | operator-- (int) |
Move the iterator to the previous position (postfix version). More... | |
MSetIterator & | operator+= (difference_type n) |
Move the iterator forwards by n positions. More... | |
MSetIterator & | operator-= (difference_type n) |
Move the iterator back by n positions. More... | |
MSetIterator | operator+ (difference_type n) const |
Return the iterator incremented by n positions. More... | |
MSetIterator | operator- (difference_type n) const |
Return the iterator decremented by n positions. More... | |
difference_type | operator- (const MSetIterator &o) const |
Return the number of positions between o and this iterator. More... | |
Xapian::doccount | get_rank () const |
Return the MSet rank for the current position. More... | |
Xapian::Document | get_document () const |
Get the Document object for the current position. More... | |
double | get_weight () const |
Get the weight for the current position. More... | |
std::string | get_collapse_key () const |
Return the collapse key for the current position. More... | |
Xapian::doccount | get_collapse_count () const |
Return a count of the number of collapses done onto the current key. More... | |
std::string | get_sort_key () const |
Return the sort key for the current position. More... | |
int | get_percent () const |
Convert the weight of the current iterator position to a percentage. More... | |
std::string | get_description () const |
Return a string describing this object. More... | |
Private Types | |
typedef std::random_access_iterator_tag | iterator_category |
typedef std::string | value_type |
typedef Xapian::termcount_diff | difference_type |
typedef std::string * | pointer |
typedef std::string & | reference |
Private Member Functions | |
MSetIterator (const Xapian::MSet &mset_, Xapian::doccount off_from_end_) | |
Private Attributes | |
Xapian::MSet | mset |
Xapian::MSet::size_type | off_from_end |
Friends | |
class | MSet |
Iterator over a Xapian::MSet.
|
private |
MSetIterator is what the C++ STL calls an random_access_iterator.
The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.
These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.
|
private |
MSetIterator is what the C++ STL calls an random_access_iterator.
The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.
These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.
|
private |
MSetIterator is what the C++ STL calls an random_access_iterator.
The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.
These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.
|
private |
MSetIterator is what the C++ STL calls an random_access_iterator.
The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.
These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.
|
private |
MSetIterator is what the C++ STL calls an random_access_iterator.
The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.
These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.
|
inlineprivate |
|
inline |
Create an unpositioned MSetIterator.
Definition at line 386 of file mset.h.
References Xapian::operator*().
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.
Definition at line 480 of file omenquire.cc.
References Assert, AssertRel, and Xapian::MSet::size().
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.
Definition at line 470 of file omenquire.cc.
References Assert, AssertRel, and Xapian::MSet::size().
string Xapian::MSetIterator::get_description | ( | ) | const |
Return a string describing this object.
Definition at line 500 of file omenquire.cc.
References Xapian::Internal::str().
Document Xapian::MSetIterator::get_document | ( | ) | const |
Get the Document object for the current position.
Definition at line 450 of file omenquire.cc.
References Assert, AssertRel, and Xapian::MSet::size().
Referenced by DEFINE_TESTCASE().
|
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!)
Definition at line 531 of file mset.h.
References Xapian::MSet::convert_to_percent().
Referenced by DEFINE_TESTCASE().
|
inline |
Return the MSet rank for the current position.
The rank of mset[0] is mset.get_firstitem().
Definition at line 477 of file mset.h.
References Xapian::MSet::get_firstitem(), and Xapian::MSet::size().
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.
Definition at line 490 of file omenquire.cc.
References Assert, AssertRel, and Xapian::MSet::size().
double Xapian::MSetIterator::get_weight | ( | ) | const |
Get the weight for the current position.
Definition at line 460 of file omenquire.cc.
References Assert, AssertRel, and Xapian::MSet::size().
Referenced by Xapian::MSet::convert_to_percent(), DEFINE_TESTCASE(), mset_range_is_same(), mset_range_is_same_weights(), and print_mset_weights().
Xapian::docid Xapian::MSetIterator::operator* | ( | ) | const |
Get the numeric document id for the current position.
Definition at line 440 of file omenquire.cc.
References Assert, AssertRel, and Xapian::MSet::size().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the number of positions between o and this iterator.
Definition at line 469 of file mset.h.
References off_from_end.
|
inline |
|
inline |
|
inline |
|
private |
The MSet we are iterating over.
Definition at line 376 of file mset.h.
Referenced by Xapian::iterator_rewind(), and Xapian::iterator_rewound().
|
private |
The current position of the iterator.
We store the offset from the end of mset, since that means MSet::end() just needs to set this member to 0.
Definition at line 383 of file mset.h.
Referenced by Xapian::MSet::fetch(), Xapian::iterator_rewind(), Xapian::iterator_rewound(), Xapian::iterator_valid(), operator-(), Xapian::operator<(), and Xapian::operator==().