xapian-core  2.0.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Xapian::Weight::Internal Class Reference

Class to hold statistics for a given collection. More...

#include <weightinternal.h>

+ Collaboration diagram for Xapian::Weight::Internal:

Public Member Functions

 Internal ()
 
Internaloperator+= (const Internal &inc)
 Add in the supplied statistics from a sub-database. More...
 
void merge (const Weight::Internal &o)
 
void set_query (const Xapian::Query &query_)
 
void accumulate_stats (const Xapian::Database::Internal &sub_db, const Xapian::RSet &rset)
 Accumulate the rtermfreqs for terms in the query. More...
 
bool get_stats (std::string_view term, Xapian::doccount &termfreq, Xapian::doccount &reltermfreq, Xapian::termcount &collfreq) const
 Get the frequencies for the given term. More...
 
bool get_stats (std::string_view term, Xapian::doccount &termfreq) const
 Get just the termfreq. More...
 
bool get_termweight (std::string_view term, double &termweight) const
 Get the termweight. More...
 
void get_max_termweight (double &min_tw, double &max_tw)
 Get the minimum and maximum termweights. More...
 
void set_max_part (const std::string &term, double max_part)
 Set max_part for a term. More...
 
Xapian::doclength get_average_length () const
 
std::string get_description () const
 Return a std::string describing this object. More...
 

Static Public Member Functions

static bool double_param (const char **p, double *ptr_val)
 
static bool param_name (const char **p, std::string &name)
 
static void parameter_error (const char *msg, const std::string &scheme, const char *params)
 

Public Attributes

Xapian::totallength total_length = 0
 Total length of all documents in the collection. More...
 
Xapian::doccount collection_size = 0
 Number of documents in the collection. More...
 
Xapian::doccount rset_size = 0
 Number of relevant documents in the collection. More...
 
Xapian::termcount db_doclength_lower_bound = 0
 A lower bound on the minimum length of any document in the database. More...
 
Xapian::termcount db_doclength_upper_bound = 0
 An upper bound on the maximum length of any document in the database. More...
 
Xapian::termcount db_unique_terms_lower_bound = 0
 A lower bound on the number of unique terms in any document. More...
 
Xapian::termcount db_unique_terms_upper_bound = 0
 An upper bound on the number of unique terms in any document. More...
 
bool have_max_part = false
 Has max_part been set for any term? More...
 
Xapian::Query query
 The query. More...
 
std::map< std::string, TermFreqs, std::less<> > termfreqs
 Map of term frequencies and relevant term frequencies for the collection. More...
 

Detailed Description

Class to hold statistics for a given collection.

Definition at line 106 of file weightinternal.h.

Constructor & Destructor Documentation

◆ Internal()

Xapian::Weight::Internal::Internal ( )
inline

Definition at line 153 of file weightinternal.h.

Member Function Documentation

◆ accumulate_stats()

void Xapian::Weight::Internal::accumulate_stats ( const Xapian::Database::Internal sub_db,
const Xapian::RSet rset 
)

◆ double_param()

static bool Xapian::Weight::Internal::double_param ( const char **  p,
double *  ptr_val 
)
inlinestatic

◆ get_average_length()

Xapian::doclength Xapian::Weight::Internal::get_average_length ( ) const
inline

Definition at line 272 of file weightinternal.h.

References Assert, collection_size, and total_length.

Referenced by Xapian::Weight::init_().

◆ get_description()

string Xapian::Weight::Internal::get_description ( ) const

Return a std::string describing this object.

Definition at line 151 of file weightinternal.cc.

References Xapian::Internal::str().

◆ get_max_termweight()

void Xapian::Weight::Internal::get_max_termweight ( double &  min_tw,
double &  max_tw 
)
inline

Get the minimum and maximum termweights.

Used by the snippet code.

Definition at line 243 of file weightinternal.h.

References rare, and termfreqs.

◆ get_stats() [1/2]

bool Xapian::Weight::Internal::get_stats ( std::string_view  term,
Xapian::doccount termfreq 
) const
inline

Get just the termfreq.

Definition at line 213 of file weightinternal.h.

References get_stats(), and term.

◆ get_stats() [2/2]

bool Xapian::Weight::Internal::get_stats ( std::string_view  term,
Xapian::doccount termfreq,
Xapian::doccount reltermfreq,
Xapian::termcount collfreq 
) const
inline

Get the frequencies for the given term.

termfreq is "n_t", the number of documents in the collection indexed by the given term.

reltermfreq is "r_t", the number of relevant documents in the collection indexed by the given term.

collfreq is the total number of occurrences of the term in all documents.

Definition at line 184 of file weightinternal.h.

References collection_size, rset_size, term, and termfreqs.

Referenced by get_stats(), and Xapian::Weight::init_().

◆ get_termweight()

bool Xapian::Weight::Internal::get_termweight ( std::string_view  term,
double &  termweight 
) const
inline

Get the termweight.

Definition at line 221 of file weightinternal.h.

References term, and termfreqs.

Referenced by Xapian::check_term().

◆ merge()

void Xapian::Weight::Internal::merge ( const Weight::Internal o)

Definition at line 141 of file weightinternal.cc.

References have_max_part, and termfreqs.

◆ operator+=()

Weight::Internal & Xapian::Weight::Internal::operator+= ( const Internal inc)

Add in the supplied statistics from a sub-database.

Used for remote databases, where we pass across a serialised stats object, unserialise it, and add it to our total.

Definition at line 55 of file weightinternal.cc.

References Assert, collection_size, db_doclength_lower_bound, db_doclength_upper_bound, db_unique_terms_lower_bound, db_unique_terms_upper_bound, min_non_zero(), rset_size, termfreqs, and total_length.

◆ param_name()

static bool Xapian::Weight::Internal::param_name ( const char **  p,
std::string &  name 
)
inlinestatic

Definition at line 309 of file weightinternal.h.

References p.

Referenced by Xapian::TfIdfWeight::create_from_parameters().

◆ parameter_error()

static void Xapian::Weight::Internal::parameter_error ( const char *  msg,
const std::string &  scheme,
const char *  params 
)
inlinestatic

Definition at line 322 of file weightinternal.h.

Referenced by Xapian::parameter_error(), and parameter_error().

◆ set_max_part()

void Xapian::Weight::Internal::set_max_part ( const std::string &  term,
double  max_part 
)
inline

Set max_part for a term.

Definition at line 262 of file weightinternal.h.

References Assert, have_max_part, term, and termfreqs.

◆ set_query()

void Xapian::Weight::Internal::set_query ( const Xapian::Query query_)
inline

Definition at line 164 of file weightinternal.h.

References AssertEq, and query.

Member Data Documentation

◆ collection_size

Xapian::doccount Xapian::Weight::Internal::collection_size = 0

Number of documents in the collection.

Definition at line 123 of file weightinternal.h.

Referenced by get_average_length(), get_stats(), Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().

◆ db_doclength_lower_bound

Xapian::termcount Xapian::Weight::Internal::db_doclength_lower_bound = 0

A lower bound on the minimum length of any document in the database.

Definition at line 129 of file weightinternal.h.

Referenced by Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().

◆ db_doclength_upper_bound

Xapian::termcount Xapian::Weight::Internal::db_doclength_upper_bound = 0

An upper bound on the maximum length of any document in the database.

Definition at line 132 of file weightinternal.h.

Referenced by Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().

◆ db_unique_terms_lower_bound

Xapian::termcount Xapian::Weight::Internal::db_unique_terms_lower_bound = 0

A lower bound on the number of unique terms in any document.

Definition at line 135 of file weightinternal.h.

Referenced by Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().

◆ db_unique_terms_upper_bound

Xapian::termcount Xapian::Weight::Internal::db_unique_terms_upper_bound = 0

An upper bound on the number of unique terms in any document.

Definition at line 138 of file weightinternal.h.

Referenced by Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().

◆ have_max_part

bool Xapian::Weight::Internal::have_max_part = false

Has max_part been set for any term?

If not, we can avoid having to serialise max_part.

Definition at line 144 of file weightinternal.h.

Referenced by merge(), serialise_stats(), set_max_part(), and unserialise_stats().

◆ query

Xapian::Query Xapian::Weight::Internal::query

The query.

Definition at line 147 of file weightinternal.h.

Referenced by set_query().

◆ rset_size

Xapian::doccount Xapian::Weight::Internal::rset_size = 0

Number of relevant documents in the collection.

Definition at line 126 of file weightinternal.h.

Referenced by get_stats(), Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().

◆ termfreqs

std::map<std::string, TermFreqs, std::less<> > Xapian::Weight::Internal::termfreqs

◆ total_length

Xapian::totallength Xapian::Weight::Internal::total_length = 0

Total length of all documents in the collection.

Definition at line 120 of file weightinternal.h.

Referenced by get_average_length(), Xapian::Weight::init_(), operator+=(), serialise_stats(), and unserialise_stats().


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