Public Member Functions | List of all members
Xapian::ValueIterator Class Reference

Class for iterating over document values. More...

Public Member Functions

 ValueIterator (const ValueIterator &o)
 Copy constructor.
 
ValueIteratoroperator= (const ValueIterator &o)
 Assignment.
 
 ValueIterator ()
 Default constructor. More...
 
 ~ValueIterator ()
 Destructor.
 
std::string operator* () const
 Return the value at the current position.
 
ValueIteratoroperator++ ()
 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. More...
 
Xapian::valueno get_valueno () const
 Return the value slot number for the current position. More...
 
void skip_to (Xapian::docid docid_or_slot)
 Advance the iterator to document id or value slot docid_or_slot. More...
 
bool check (Xapian::docid docid)
 Check if the specified docid occurs. More...
 
std::string get_description () const
 Return a string describing this object.
 

Detailed Description

Class for iterating over document values.

Constructor & Destructor Documentation

Xapian::ValueIterator::ValueIterator ( )
inline

Default constructor.

Creates an uninitialised iterator, which can't be used before being assigned to, but is sometimes syntactically convenient.

Member Function Documentation

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

Parameters
docidThe 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.

Parameters
docid_or_slotThe docid/slot to advance to.

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

Documentation for Xapian (version 1.4.0).
Generated on Wed Oct 12 2016 by Doxygen 1.8.11.