xapian-core
1.4.27
|
Class for iterating over document values. More...
#include <valueiterator.h>
Public Member Functions | |
ValueIterator (const ValueIterator &o) | |
Copy constructor. | |
ValueIterator & | operator= (const ValueIterator &o) |
Assignment. | |
ValueIterator () | |
Default constructor. | |
~ValueIterator () | |
Destructor. | |
std::string | operator* () const |
Return the value at the current position. | |
ValueIterator & | operator++ () |
Advance the iterator to the next position. | |
DerefWrapper_< std::string > | operator++ (int) |
Advance the iterator to the next position (postfix version). | |
Xapian::docid | get_docid () const |
Return the docid at the current position. | |
Xapian::valueno | get_valueno () const |
Return the value slot number for the current position. | |
void | skip_to (Xapian::docid docid_or_slot) |
Advance the iterator to document id or value slot docid_or_slot. | |
bool | check (Xapian::docid docid) |
Check if the specified docid occurs. | |
std::string | get_description () const |
Return a string describing this object. | |
Class for iterating over document values.
|
inline |
Default constructor.
Creates an uninitialised iterator, which can't be used before being assigned to, but is sometimes syntactically convenient.
bool Xapian::ValueIterator::check | ( | Xapian::docid | docid | ) |
Check if the specified docid occurs.
The caller is required to ensure that the specified document id did actually exists in the database.
This method acts like skip_to() if that can be done at little extra cost, in which case it then returns true. This is how chert and glass databases behave because they store values in streams which allow for an efficient implementation of skip_to().
Otherwise it simply checks if a particular docid is present. If it is, it returns true. If it isn't, it returns false, and leaves the position unspecified (and hence the result of calling methods which depend on the current position, such as get_docid(), are also unspecified). In this state, next() will advance to the first matching position after document did, and skip_to() will act as it would if the position was the first matching position after document did.
Currently the inmemory and remote backends behave in the latter way because they don't support streamed values and so skip_to() must check each document it skips over which is significantly slower.
docid | The document id to check. |
Xapian::docid Xapian::ValueIterator::get_docid | ( | ) | const |
Return the docid at the current position.
If we're iterating over values of a document, this method will throw Xapian::InvalidOperationError.
Xapian::valueno Xapian::ValueIterator::get_valueno | ( | ) | const |
Return the value slot number for the current position.
If the iterator is over all values in a slot, this returns that slot's number. If the iterator is over the values in a particular document, it returns the number of each slot in turn.
void Xapian::ValueIterator::skip_to | ( | Xapian::docid | docid_or_slot | ) |
Advance the iterator to document id or value slot docid_or_slot.
If this iterator is over values in a document, then this method advances the iterator to value slot docid_or_slot, or the first slot after it if there is no value in slot slot.
If this iterator is over values in a particular slot, then this method advances the iterator to document id docid_or_slot, or the first document id after it if there is no value in the slot we're iterating over for document docid_or_slot.
Note: The "two-faced" nature of this method is due to how C++ overloading works. Xapian::docid and Xapian::valueno are both typedefs for the same unsigned integer type, so overloading can't distinguish them.
docid_or_slot | The docid/slot to advance to. |