xapian-core
1.4.27
|
Abstract base class for match spies. More...
#include <matchspy.h>
Public Member Functions | |
MatchSpy () | |
Default constructor, needed by subclass constructors. More... | |
virtual | ~MatchSpy () |
Virtual destructor, because we have virtual methods. More... | |
virtual void | operator() (const Xapian::Document &doc, double wt)=0 |
Register a document with the match spy. More... | |
virtual MatchSpy * | clone () const |
Clone the match spy. More... | |
virtual std::string | name () const |
Return the name of this match spy. More... | |
virtual std::string | serialise () const |
Return this object's parameters serialised as a single string. More... | |
virtual MatchSpy * | unserialise (const std::string &serialised, const Registry &context) const |
Unserialise parameters. More... | |
virtual std::string | serialise_results () const |
Serialise the results of this match spy. More... | |
virtual void | merge_results (const std::string &serialised) |
Unserialise some results, and merge them into this matchspy. More... | |
virtual std::string | get_description () const |
Return a string describing this object. More... | |
MatchSpy * | release () |
Start reference counting this object. More... | |
const MatchSpy * | release () const |
Start reference counting this object. More... | |
Public Member Functions inherited from Xapian::Internal::opt_intrusive_base | |
opt_intrusive_base (const opt_intrusive_base &) | |
opt_intrusive_base & | operator= (const opt_intrusive_base &) |
opt_intrusive_base () | |
Construct object which is initially not reference counted. More... | |
virtual | ~opt_intrusive_base () |
void | ref () const |
void | unref () const |
Private Member Functions | |
void | operator= (const MatchSpy &) |
Don't allow assignment. More... | |
MatchSpy (const MatchSpy &) | |
Don't allow copying. More... | |
Additional Inherited Members | |
Public Attributes inherited from Xapian::Internal::opt_intrusive_base | |
unsigned | _refs |
Reference count. More... | |
Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base | |
void | release () const |
Start reference counting. More... | |
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.
Definition at line 49 of file matchspy.h.
|
private |
Don't allow copying.
|
inline |
Default constructor, needed by subclass constructors.
Definition at line 60 of file matchspy.h.
References name.
|
virtual |
Virtual destructor, because we have virtual methods.
Definition at line 48 of file matchspy.cc.
|
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". 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
Reimplemented in ExceptionalMatchSpy, and Xapian::ValueCountMatchSpy.
Definition at line 51 of file matchspy.cc.
Referenced by DEFINE_TESTCASE().
|
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.
Definition at line 81 of file matchspy.cc.
References unsupported_method().
Referenced by DEFINE_TESTCASE().
|
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.
serialised | A string containing the serialised results. |
Reimplemented in Xapian::ValueCountMatchSpy.
Definition at line 76 of file matchspy.cc.
Referenced by DEFINE_TESTCASE().
|
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 ExceptionalMatchSpy, and Xapian::ValueCountMatchSpy.
Definition at line 56 of file matchspy.cc.
Referenced by Xapian::Registry::Internal::add_defaults(), DEFINE_TESTCASE(), and Xapian::Registry::register_match_spy().
|
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.
doc | The document seen by the match spy. |
wt | The weight of the document. |
Implemented in ExceptionalMatchSpy, TestMatchSpy, MySpy, Xapian::ValueCountMatchSpy, MultipleMatchSpy, and SimpleMatchSpy.
|
private |
Don't allow assignment.
|
inline |
Start reference counting this object.
You can transfer ownership of a dynamically allocated MatchSpy 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.
Definition at line 184 of file matchspy.h.
Referenced by DEFINE_TESTCASE(), and RemoteServer::msg_query().
|
inline |
Start reference counting this object.
You can transfer ownership of a dynamically allocated MatchSpy 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.
Definition at line 196 of file matchspy.h.
|
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.
Definition at line 61 of file matchspy.cc.
Referenced by DEFINE_TESTCASE().
|
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.
Definition at line 71 of file matchspy.cc.
Referenced by DEFINE_TESTCASE().
|
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". 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
serialised | A string containing the serialised results. |
context | Registry object to use for unserialisation to permit MatchSpy subclasses with sub-MatchSpy objects to be implemented. |
Reimplemented in Xapian::ValueCountMatchSpy.
Definition at line 66 of file matchspy.cc.
Referenced by DEFINE_TESTCASE(), and RemoteServer::msg_query().