xapian-core  2.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MultiValueList Class Reference

Class for merging ValueList objects from subdatabases. More...

#include <multi_valuelist.h>

+ Inheritance diagram for MultiValueList:
+ Collaboration diagram for MultiValueList:

Public Member Functions

 MultiValueList (Xapian::doccount n_shards_, SubValueList **valuelists_, Xapian::valueno slot_)
 Constructor. More...
 
 ~MultiValueList ()
 Destructor. More...
 
Xapian::docid get_docid () const
 Return the docid at the current position. More...
 
std::string get_value () const
 Return the value at the current position. More...
 
Xapian::valueno get_valueno () const
 Return the value slot for the current position/this iterator. More...
 
bool at_end () const
 Return true if the current position is past the last entry in this list. More...
 
void next ()
 Advance the current position to the next document in the value stream. More...
 
void skip_to (Xapian::docid)
 Skip forward to the specified docid. More...
 
bool check (Xapian::docid did)
 Check if the specified docid occurs in this valuestream. More...
 
std::string get_description () const
 Return a string description of this object. More...
 
- Public Member Functions inherited from Xapian::ValueIterator::Internal
virtual ~Internal ()
 We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor. More...
 
- Public Member Functions inherited from Xapian::Internal::intrusive_base
 intrusive_base ()
 Construct with no references. More...
 

Private Member Functions

void operator= (const MultiValueList &)
 Don't allow assignment. More...
 
 MultiValueList (const MultiValueList &)
 Don't allow copying. More...
 

Private Attributes

Xapian::docid current_docid = 0
 Current docid (or 0 if we haven't started yet). More...
 
Xapian::doccount count
 Number of SubValueList* entries in valuelists. More...
 
SubValueList ** valuelists
 Array of sub-valuelists which we use as a heap. More...
 
Xapian::valueno slot
 The value slot we're iterating over. More...
 
Xapian::doccount n_shards
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::ValueIterator::Internal
 Internal ()
 Only constructable as a base class for derived classes. More...
 

Detailed Description

Class for merging ValueList objects from subdatabases.

Definition at line 69 of file multi_valuelist.h.

Constructor & Destructor Documentation

◆ MultiValueList() [1/2]

MultiValueList::MultiValueList ( const MultiValueList )
private

Don't allow copying.

◆ MultiValueList() [2/2]

MultiValueList::MultiValueList ( Xapian::doccount  n_shards_,
SubValueList **  valuelists_,
Xapian::valueno  slot_ 
)
inline

Constructor.

Definition at line 92 of file multi_valuelist.h.

◆ ~MultiValueList()

MultiValueList::~MultiValueList ( )

Destructor.

Definition at line 47 of file multi_valuelist.cc.

Member Function Documentation

◆ at_end()

bool MultiValueList::at_end ( ) const
virtual

Return true if the current position is past the last entry in this list.

Implements Xapian::ValueIterator::Internal.

Definition at line 75 of file multi_valuelist.cc.

◆ check()

bool MultiValueList::check ( Xapian::docid  did)
virtual

Check if the specified docid occurs in this valuestream.

The caller is required to ensure that the specified docid 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 sets valid to true.

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 docid, and skip_to() will act as it would if the position was the first matching position after docid.

The default implementation calls skip_to().

Reimplemented from Xapian::ValueIterator::Internal.

Definition at line 151 of file multi_valuelist.cc.

◆ get_description()

string MultiValueList::get_description ( ) const
virtual

Return a string description of this object.

Implements Xapian::ValueIterator::Internal.

Definition at line 159 of file multi_valuelist.cc.

◆ get_docid()

Xapian::docid MultiValueList::get_docid ( ) const
virtual

Return the docid at the current position.

Implements Xapian::ValueIterator::Internal.

Definition at line 55 of file multi_valuelist.cc.

References Assert.

◆ get_value()

std::string MultiValueList::get_value ( ) const
virtual

Return the value at the current position.

Implements Xapian::ValueIterator::Internal.

Definition at line 62 of file multi_valuelist.cc.

References Assert.

◆ get_valueno()

Xapian::valueno MultiValueList::get_valueno ( ) const
virtual

Return the value slot for the current position/this iterator.

Implements Xapian::ValueIterator::Internal.

Definition at line 69 of file multi_valuelist.cc.

◆ next()

void MultiValueList::next ( )
virtual

Advance the current position to the next document in the value stream.

The list starts before the first entry in the list, so next(), skip_to() or check() must be called before any methods which need the context of the current position.

Implements Xapian::ValueIterator::Internal.

Definition at line 81 of file multi_valuelist.cc.

References SubValueList::at_end(), Heap::make(), SubValueList::next(), Heap::pop(), rare, and Heap::replace().

◆ operator=()

void MultiValueList::operator= ( const MultiValueList )
private

Don't allow assignment.

◆ skip_to()

void MultiValueList::skip_to ( Xapian::docid  did)
virtual

Skip forward to the specified docid.

If the specified docid isn't in the list, position ourselves on the first document after it (or at_end() if no greater docids are present).

Implements Xapian::ValueIterator::Internal.

Definition at line 124 of file multi_valuelist.cc.

References Heap::make(), and rare.

Member Data Documentation

◆ count

Xapian::doccount MultiValueList::count
private

Number of SubValueList* entries in valuelists.

Definition at line 80 of file multi_valuelist.h.

◆ current_docid

Xapian::docid MultiValueList::current_docid = 0
private

Current docid (or 0 if we haven't started yet).

Definition at line 77 of file multi_valuelist.h.

◆ n_shards

Xapian::doccount MultiValueList::n_shards
private

Definition at line 88 of file multi_valuelist.h.

◆ slot

Xapian::valueno MultiValueList::slot
private

The value slot we're iterating over.

Definition at line 86 of file multi_valuelist.h.

◆ valuelists

SubValueList** MultiValueList::valuelists
private

Array of sub-valuelists which we use as a heap.

Definition at line 83 of file multi_valuelist.h.


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