#include <enquire.h>
Inheritance diagram for Xapian::TradWeight:
Public Member Functions | |
TradWeight (double k) | |
Construct a TradWeight. | |
TradWeight * | clone () const |
Return a new weight object of this type. | |
std::string | name () const |
Name of the weighting scheme. | |
std::string | serialise () const |
Serialise object parameters into a string. | |
TradWeight * | 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 |
This class implements the Traditional Probabilistic Weighting scheme, as described by the early papers on Probabilistic Retrieval. BM25 generally gives better results.
The Traditional weighting scheme formula is
where
TradWeight(k) is equivalent to BM25Weight(k, 0, 0, 1, 0), except that the latter returns weights (k+1) times larger.
Xapian::TradWeight::TradWeight | ( | double | k | ) | [inline, explicit] |
Construct a TradWeight.
k | parameter governing the importance of within document frequency and document length - any non-negative number (0 meaning to ignore wdf and doc length when calculating weights). Default is 1. |
TradWeight* Xapian::TradWeight::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.
std::string Xapian::TradWeight::name | ( | ) | const [virtual] |
Name of the weighting scheme.
If the subclass is called FooWeight, this should return "Foo".
Implements Xapian::Weight.
std::string Xapian::TradWeight::serialise | ( | ) | const [virtual] |
TradWeight* Xapian::TradWeight::unserialise | ( | const std::string & | s | ) | const [virtual] |
Xapian::weight Xapian::TradWeight::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.
Xapian::weight Xapian::TradWeight::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.
Xapian::weight Xapian::TradWeight::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.
Xapian::weight Xapian::TradWeight::get_maxextra | ( | ) | const [virtual] |
Gets the maximum value that get_sumextra() may return.
This is used in optimising searches.
Implements Xapian::Weight.
bool Xapian::TradWeight::get_sumpart_needs_doclength | ( | ) | const [virtual] |