Xapian::MatchSpy Class Reference

Abstract base class for match spies. More...

Inheritance diagram for Xapian::MatchSpy:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~MatchSpy ()
 Virtual destructor, because we have virtual methods.
virtual void operator() (const Xapian::Document &doc, Xapian::weight wt)=0
 Register a document with the match spy.
virtual MatchSpyclone () const
 Clone the match spy.
virtual std::string name () const
 Return the name of this match spy.
virtual std::string serialise () const
 Return this object's parameters serialised as a single string.
virtual MatchSpyunserialise (const std::string &s, const Registry &context) const
 Unserialise parameters.
virtual std::string serialise_results () const
 Serialise the results of this match spy.
virtual void merge_results (const std::string &s)
 Unserialise some results, and merge them into this matchspy.
virtual std::string get_description () const
 Return a string describing this object.

Protected Member Functions

 MatchSpy ()
 Default constructor, needed by subclass constructors.


Detailed Description

Abstract base class for match spies.

The subclasses will generally accumulate information seen during the match, to calculate aggregate functions, or other profiles of the matching documents.


Constructor & Destructor Documentation

virtual Xapian::MatchSpy::~MatchSpy (  )  [virtual]

Virtual destructor, because we have virtual methods.


Member Function Documentation

virtual MatchSpy* Xapian::MatchSpy::clone (  )  const [virtual]

Clone the match spy.

The clone should inherit the configuration of the parent, but need not inherit the state. ie, the clone does not need to be passed information about the results seen by the parent.

If you don't want to support the remote backend in your match spy, 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". It must therefore have been allocated with "new".

Reimplemented in Xapian::ValueCountMatchSpy.

virtual std::string Xapian::MatchSpy::get_description (  )  const [virtual]

Return a string describing this object.

This default implementation returns a generic answer, to avoid forcing those deriving their own MatchSpy subclasses from having to implement this (they may not care what get_description() gives for their subclass).

Reimplemented in Xapian::ValueCountMatchSpy.

virtual void Xapian::MatchSpy::merge_results ( const std::string &  s  )  [virtual]

Unserialise some results, and merge them into this matchspy.

The order in which results are merged should not be significant, since this order is not specified (and will vary depending on the speed of the search in each sub-database).

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

Reimplemented in Xapian::ValueCountMatchSpy.

virtual std::string Xapian::MatchSpy::name (  )  const [virtual]

Return the name of this match spy.

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::FooMatchSpy, return "MyApp::FooMatchSpy" from this method.

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

Reimplemented in Xapian::ValueCountMatchSpy.

virtual void Xapian::MatchSpy::operator() ( const Xapian::Document doc,
Xapian::weight  wt 
) [pure virtual]

Register a document with the match spy.

This is called by the matcher once with each document seen by the matcher during the match process. Note that the matcher will often not see all the documents which match the query, due to optimisations which allow low-weighted documents to be skipped, and allow the match process to be terminated early.

Parameters:
doc The document seen by the match spy.
wt The weight of the document.

Implemented in Xapian::ValueCountMatchSpy.

virtual std::string Xapian::MatchSpy::serialise (  )  const [virtual]

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

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

Reimplemented in Xapian::ValueCountMatchSpy.

virtual std::string Xapian::MatchSpy::serialise_results (  )  const [virtual]

Serialise the results of this match spy.

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

Reimplemented in Xapian::ValueCountMatchSpy.

virtual MatchSpy* Xapian::MatchSpy::unserialise ( const std::string &  s,
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 match spy, 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". It must therefore have been allocated with "new".

Reimplemented in Xapian::ValueCountMatchSpy.


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

Documentation for Xapian (version 1.2.4).
Generated on 19 Dec 2010 by Doxygen 1.5.9.