#include <scaleweight.h>
Inheritance diagram for ScaleWeight:
Public Member Functions | |
ScaleWeight * | clone () const |
Return a new weight object of this type. | |
ScaleWeight (Xapian::Weight *real_wt_, double factor_) | |
~ScaleWeight () | |
std::string | name () const |
Name of the weighting scheme. | |
std::string | serialise () const |
Serialise object parameters into a string. | |
ScaleWeight * | unserialise (const std::string &s) const |
Create object given string serialisation returned by serialise(). | |
Xapian::weight | get_sumpart (Xapian::termcount wdf, Xapian::doclength len) const |
Get a weight which is part of the sum over terms being performed. | |
Xapian::weight | get_maxpart () const |
Gets the maximum value that get_sumpart() may return. | |
Xapian::weight | get_sumextra (Xapian::doclength len) const |
Get an extra weight for a document to add to the sum calculated over the query terms. | |
Xapian::weight | get_maxextra () const |
Gets the maximum value that get_sumextra() may return. | |
bool | get_sumpart_needs_doclength () const |
return false if the weight object doesn't need doclength | |
Private Attributes | |
Xapian::Weight * | real_wt |
double | factor |
Definition at line 27 of file scaleweight.h.
ScaleWeight::ScaleWeight | ( | Xapian::Weight * | real_wt_, | |
double | factor_ | |||
) | [inline] |
ScaleWeight::~ScaleWeight | ( | ) |
ScaleWeight * ScaleWeight::clone | ( | ) | const [virtual] |
Return a new weight object of this type.
A subclass called FooWeight taking parameters param1 and param2 should implement this as:
virtual FooWeight * clone() const { return new FooWeight(param1, param2); }
Implements Xapian::Weight.
Definition at line 28 of file scaleweight.cc.
References Xapian::Weight::clone(), factor, real_wt, and ScaleWeight().
std::string ScaleWeight::name | ( | ) | const [virtual] |
Name of the weighting scheme.
If the subclass is called FooWeight, this should return "Foo".
Implements Xapian::Weight.
Definition at line 35 of file scaleweight.cc.
std::string ScaleWeight::serialise | ( | ) | const [virtual] |
Serialise object parameters into a string.
Implements Xapian::Weight.
Definition at line 40 of file scaleweight.cc.
References factor, real_wt, Xapian::Weight::serialise(), and serialise_double().
ScaleWeight * ScaleWeight::unserialise | ( | const std::string & | s | ) | const [virtual] |
Create object given string serialisation returned by serialise().
Implements Xapian::Weight.
Definition at line 45 of file scaleweight.cc.
References real_wt, ScaleWeight(), Xapian::Weight::unserialise(), and unserialise_double().
Xapian::weight ScaleWeight::get_sumpart | ( | Xapian::termcount | wdf, | |
Xapian::doclength | len | |||
) | const [virtual] |
Get a weight which is part of the sum over terms being performed.
This returns a weight for a given term and document. These weights are summed to give a total weight for the document.
wdf | the within document frequency of the term. | |
len | the (unnormalised) document length. |
Implements Xapian::Weight.
Definition at line 55 of file scaleweight.cc.
References factor, Xapian::Weight::get_sumpart(), and real_wt.
Xapian::weight ScaleWeight::get_maxpart | ( | ) | const [virtual] |
Gets the maximum value that get_sumpart() may return.
This is used in optimising searches, by having the postlist tree decay appropriately when parts of it can have limited, or no, further effect.
Implements Xapian::Weight.
Definition at line 61 of file scaleweight.cc.
References factor, Xapian::Weight::get_maxpart(), and real_wt.
Xapian::weight ScaleWeight::get_sumextra | ( | Xapian::doclength | len | ) | const [virtual] |
Get an extra weight for a document to add to the sum calculated over the query terms.
This returns a weight for a given document, and is used by some weighting schemes to account for influence such as document length.
len | the (unnormalised) document length. |
Implements Xapian::Weight.
Definition at line 65 of file scaleweight.cc.
References factor, Xapian::Weight::get_sumextra(), and real_wt.
Xapian::weight ScaleWeight::get_maxextra | ( | ) | const [virtual] |
Gets the maximum value that get_sumextra() may return.
This is used in optimising searches.
Implements Xapian::Weight.
Definition at line 69 of file scaleweight.cc.
References factor, Xapian::Weight::get_maxextra(), and real_wt.
bool ScaleWeight::get_sumpart_needs_doclength | ( | ) | const [virtual] |
return false if the weight object doesn't need doclength
Reimplemented from Xapian::Weight.
Definition at line 73 of file scaleweight.cc.
References Xapian::Weight::get_sumpart_needs_doclength(), and real_wt.
Xapian::Weight* ScaleWeight::real_wt [private] |
Definition at line 28 of file scaleweight.h.
Referenced by clone(), get_maxextra(), get_maxpart(), get_sumextra(), get_sumpart(), get_sumpart_needs_doclength(), serialise(), unserialise(), and ~ScaleWeight().
double ScaleWeight::factor [private] |
Definition at line 30 of file scaleweight.h.
Referenced by clone(), get_maxextra(), get_maxpart(), get_sumextra(), get_sumpart(), and serialise().