#include <stats.h>
Public Member Functions | |
Stats () | |
Stats & | operator+= (const Stats &inc) |
Add in the supplied statistics from a sub-database. | |
Xapian::doccount | get_termfreq (const string &tname) const |
Get the term-frequency of the given term. | |
void | set_termfreq (const string &tname, Xapian::doccount tfreq) |
Set the term-frequency for the given term. | |
Xapian::doccount | get_reltermfreq (const string &tname) const |
Get the relevant term-frequency for the given term. | |
void | set_reltermfreq (const string &tname, Xapian::doccount rtfreq) |
Set the relevant term-frequency for the given term. | |
string | get_description () const |
Return a string describing this object. | |
~Stats () | |
Destructor - delete the internals registered. | |
Xapian::Weight::Internal * | create_weight_internal () const |
Create and return a Weight::Internal object with global statistics. | |
Xapian::Weight::Internal * | create_weight_internal (const string &tname) const |
Create and return a Weight::Internal object with global and term statistics. | |
Public Attributes | |
Xapian::doccount | collection_size |
Number of documents in the collection. | |
Xapian::doccount | rset_size |
Number of relevant documents in the collection. | |
Xapian::doclength | average_length |
Average length of documents in the collection. | |
std::map< string, Xapian::doccount > | termfreq |
Map of term frequencies for the collection. | |
std::map< string, Xapian::doccount > | reltermfreq |
Map of relevant term frequencies for the collection. | |
list< Xapian::Weight::Internal * > | weight_internals |
A list of all the Xapian::Weight::Internals allocated. |
Definition at line 38 of file stats.h.
Stats::~Stats | ( | ) | [inline] |
Destructor - delete the internals registered.
FIXME:1.1: remove this - just use the default.
Definition at line 109 of file stats.h.
References weight_internals.
Add in the supplied statistics from a sub-database.
Definition at line 159 of file stats.h.
References average_length, collection_size, reltermfreq, rset_size, and termfreq.
Xapian::doccount Stats::get_termfreq | ( | const string & | tname | ) | const [inline] |
Get the term-frequency of the given term.
This is "n_t", the number of documents in the collection indexed by the given term.
Definition at line 187 of file stats.h.
References Assert, and termfreq.
Referenced by LocalSubMatch::postlist_from_op_leaf_query().
void Stats::set_termfreq | ( | const string & | tname, | |
Xapian::doccount | tfreq | |||
) | [inline] |
Set the term-frequency for the given term.
Definition at line 199 of file stats.h.
References Assert, and termfreq.
Referenced by LocalSubMatch::prepare_match().
Xapian::doccount Stats::get_reltermfreq | ( | const string & | tname | ) | const [inline] |
Get the relevant term-frequency for the given term.
This is "r_t", the number of relevant documents in the collection indexed by the given term.
Definition at line 209 of file stats.h.
References Assert, and reltermfreq.
void Stats::set_reltermfreq | ( | const string & | tname, | |
Xapian::doccount | rtfreq | |||
) | [inline] |
Set the relevant term-frequency for the given term.
Definition at line 221 of file stats.h.
References Assert, and reltermfreq.
Referenced by RSetI::contribute_stats().
std::string Stats::get_description | ( | ) | const |
Return a string describing this object.
Definition at line 29 of file stats.cc.
References average_length, collection_size, om_tostring(), reltermfreq, rset_size, and termfreq.
Xapian::Weight::Internal* Stats::create_weight_internal | ( | ) | const [inline] |
Create and return a Weight::Internal object with global statistics.
FIXME:1.1: remove this method - just create it directly.
All term-specific statistics will be set to 0.
The caller must NOT delete the returned object after use - it is owned by the Stats object.
stats | Object containing the statistics to use. |
Definition at line 128 of file stats.h.
References AutoPtr< _Tp >::get(), AutoPtr< _Tp >::release(), and weight_internals.
Referenced by LocalSubMatch::postlist_from_op_leaf_query().
Xapian::Weight::Internal* Stats::create_weight_internal | ( | const string & | tname | ) | const [inline] |
Create and return a Weight::Internal object with global and term statistics.
FIXME:1.1: remove this method - just create it directly.
The caller must NOT delete the returned object after use - it is owned by the Stats object.
stats | Object containing the statistics to use. | |
tname | The term to read the term-specific statistics for. |
Definition at line 146 of file stats.h.
References AutoPtr< _Tp >::get(), AutoPtr< _Tp >::release(), and weight_internals.
Number of documents in the collection.
Definition at line 41 of file stats.h.
Referenced by get_description(), operator+=(), LocalSubMatch::prepare_match(), and serialise_stats().
Number of relevant documents in the collection.
Definition at line 44 of file stats.h.
Referenced by RSetI::contribute_stats(), get_description(), operator+=(), and serialise_stats().
Average length of documents in the collection.
Definition at line 47 of file stats.h.
Referenced by get_description(), operator+=(), LocalSubMatch::prepare_match(), and serialise_stats().
std::map<string, Xapian::doccount> Stats::termfreq |
Map of term frequencies for the collection.
Definition at line 50 of file stats.h.
Referenced by get_description(), get_termfreq(), operator+=(), serialise_stats(), and set_termfreq().
std::map<string, Xapian::doccount> Stats::reltermfreq |
Map of relevant term frequencies for the collection.
Definition at line 53 of file stats.h.
Referenced by get_description(), get_reltermfreq(), operator+=(), serialise_stats(), and set_reltermfreq().
list<Xapian::Weight::Internal *> Stats::weight_internals [mutable] |
A list of all the Xapian::Weight::Internals allocated.
These will be deleted by the destructor.
FIXME:1.1: this should be removed for the 1.1 release. In 1.0, the constructor of Xapian::Weight doesn't initialise its "internal" member to NULL. This means that we can't delete the object pointed to by "internal" in the destructor, because it may not be initialised. Therefore, we have to register the objects somewhere else, and delete them another way. We use the Stats object for this purpose, since they're related to it.
Definition at line 103 of file stats.h.
Referenced by create_weight_internal(), and ~Stats().