Xapian::KeyMaker Class Referenceabstract

Virtual base class for key making functors. More...

`#include <keymaker.h>`

Inheritance diagram for Xapian::KeyMaker:
[legend]

## Public Member Functions

| KeyMaker ()
| Default constructor.
virtual std::string | operator() (const Xapian::Document &doc) const =0
| Build a key string for a Document.
virtual | ~KeyMaker ()
| Virtual destructor, because we have virtual methods.
virtual std::string | name () const
| Return the name of this KeyMaker.
virtual std::string | serialise () const
| Return this object's parameters serialised as a single string.
virtual KeyMaker * | unserialise (const std::string &serialised, const Registry &context) const
| Unserialise parameters.
KeyMaker * | release ()
| Start reference counting this object.
const KeyMaker * | release () const
| Start reference counting this object.

## Detailed Description

Virtual base class for key making functors.

## Member Function Documentation

## name()

virtual std::string Xapian::KeyMaker::name | ( |  | ) | const

virtual

Return the name of this KeyMaker.

This name is used by the remote backend. It is passed with the serialised parameters to the remote server so that it knows which class to create.

Return the full namespace-qualified name of your class here - if your class is called MyApp::FooKeyMaker, return "MyApp::FooKeyMaker" from this method.

If you don't want to support the remote backend in your KeyMaker, you can use the default implementation which simply throws Xapian::UnimplementedError.

Reimplemented in Xapian::MultiValueKeyMaker.

## operator()()

virtual std::string Xapian::KeyMaker::operator() | ( | const Xapian::Document & | doc | ) | const

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

Implemented in Xapian::LatLongDistanceKeyMaker, and Xapian::MultiValueKeyMaker.

## release() [1/2]

KeyMaker * Xapian::KeyMaker::release | ( |  | ) |

inline

Start reference counting this object.

You can transfer ownership of a dynamically allocated KeyMaker object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.

## release() [2/2]

const KeyMaker * Xapian::KeyMaker::release | ( |  | ) | const

inline

Start reference counting this object.

You can transfer ownership of a dynamically allocated KeyMaker object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.

## serialise()

virtual std::string Xapian::KeyMaker::serialise | ( |  | ) | const

virtual

Return this object's parameters serialised as a single string.

If there are no parameters, just return an empty string.

If you don't want to support the remote backend in your KeyMaker, you can use the default implementation which simply throws Xapian::UnimplementedError.

Reimplemented in Xapian::MultiValueKeyMaker.

## unserialise()

virtual KeyMaker * Xapian::KeyMaker::unserialise | ( | const std::string & | serialised,
|  | const Registry & | context ) const

virtual

Unserialise parameters.

This method unserialises parameters serialised by the serialise() method and allocates and returns a new object initialised with them.

If you don't want to support the remote backend in your KeyMaker, you can use the default implementation which simply throws Xapian::UnimplementedError.

Note that the returned object will be deallocated by Xapian after use with "delete". If you want to handle the deletion in a special way (for example when wrapping the Xapian API for use from another language) then you can define a static `operator delete` method in your subclass as shown here: https://trac.xapian.org/ticket/554#comment:1

Parameters

  serialised | A string containing the serialised results.
  context | Registry object to use for unserialisation to permit KeyMaker subclasses with sub-KeyMaker objects to be implemented.

Reimplemented in Xapian::MultiValueKeyMaker.

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

- xapian/keymaker.h