Xapian::MultiValueKeyMaker Class Reference

KeyMaker subclass which combines several values. More...

#include <keymaker.h>

Inheritance diagram for Xapian::MultiValueKeyMaker:

Inheritance graph
[legend]
Collaboration diagram for Xapian::MultiValueKeyMaker:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MultiValueKeyMaker ()
template<class Iterator >
 MultiValueKeyMaker (Iterator begin, Iterator end)
virtual std::string operator() (const Xapian::Document &doc) const
 Build a key string for a Document.
void add_value (Xapian::valueno slot, bool reverse=false)

Private Attributes

std::vector< std::pair
< Xapian::valueno, bool > > 
slots


Detailed Description

KeyMaker subclass which combines several values.

When the result is used for sorting, results are ordered by the first value. In the event of a tie, the second is used. If this is the same for both, the third is used, and so on. If reverse is true for a value, then the sort order for that value is reversed.

When used for collapsing, the documents will only be considered equal if all the values specified match. If none of the specified values are set then the generated key will be empty, so such documents won't be collapsed (which is consistent with the behaviour in the "collapse on a value" case). If you'd prefer that documents with none of the keys set are collapsed together, then you can set reverse for at least one of the values. Other than this, it isn't useful to set reverse for collapsing.

Definition at line 65 of file keymaker.h.


Constructor & Destructor Documentation

Xapian::MultiValueKeyMaker::MultiValueKeyMaker (  )  [inline]

Definition at line 69 of file keymaker.h.

template<class Iterator >
Xapian::MultiValueKeyMaker::MultiValueKeyMaker ( Iterator  begin,
Iterator  end 
) [inline]

Definition at line 72 of file keymaker.h.


Member Function Documentation

void Xapian::MultiValueKeyMaker::add_value ( Xapian::valueno  slot,
bool  reverse = false 
) [inline]

Definition at line 78 of file keymaker.h.

Referenced by DEFINE_TESTCASE().

string Xapian::MultiValueKeyMaker::operator() ( const Xapian::Document doc  )  const [virtual]

Build a key string for a Document.

These keys can be used for sorting or collapsing matching documents.

Parameters:
doc Document object to build a key for.

Implements Xapian::KeyMaker.

Definition at line 37 of file keymaker.cc.

References Xapian::Document::get_value(), rare, and slots.


Member Data Documentation

std::vector<std::pair<Xapian::valueno, bool> > Xapian::MultiValueKeyMaker::slots [private]

Definition at line 66 of file keymaker.h.

Referenced by operator()().


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

Documentation for Xapian (version 1.2.9).
Generated on 10 May 2012 by Doxygen 1.5.9.