xapian-core  1.5.0
Public Member Functions | List of all members
Xapian::KeyMaker Class Referenceabstract

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

+ Inheritance diagram for Xapian::KeyMaker:

Public Member Functions

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

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
docDocument object to build a key for.

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

◆ release() [1/2]

KeyMaker* Xapian::KeyMaker::release ( )
inline

Start reference counting this object.

You can hand 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 hand 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
serialisedA string containing the serialised results.
contextRegistry 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: