xapian-core  1.4.20
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 (const std::string &term, Xapian::doccount &termfreq, Xapian::doccount &reltermfreq, Xapian::termcount &collfreq) const
 Get the frequencies for the given term. More...
 
bool get_stats (const std::string &term, Xapian::doccount &termfreq) const
 Get just the termfreq. More...
 
bool get_termweight (const std::string &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
 
void set_bounds_from_db (const Xapian::Database &db_)
 Set the "bounds" stats from Database db. More...
 
std::string get_description () const
 Return a std::string describing this object. More...
 

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...
 
bool have_max_part = false
 Has max_part been set for any term? More...
 
Xapian::Database db
 Database to get the bounds on doclength and wdf from. More...
 
Xapian::Query query
 The query. More...
 
std::map< std::string, TermFreqstermfreqs
 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 70 of file weightinternal.h.

Constructor & Destructor Documentation

◆ Internal()

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

Definition at line 108 of file weightinternal.h.

References TermFreqs::operator+=().

Member Function Documentation

◆ accumulate_stats()

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

◆ get_average_length()

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

Definition at line 225 of file weightinternal.h.

References rare.

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

◆ get_description()

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

Return a std::string describing this object.

Definition at line 131 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 198 of file weightinternal.h.

References TermFreqs::max_part, and rare.

◆ get_stats() [1/2]

bool Xapian::Weight::Internal::get_stats ( const std::string &  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 139 of file weightinternal.h.

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

◆ get_stats() [2/2]

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

Get just the termfreq.

Definition at line 168 of file weightinternal.h.

◆ get_termweight()

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

Get the termweight.

Definition at line 176 of file weightinternal.h.

Referenced by Xapian::check_term().

◆ merge()

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

Definition at line 121 of file weightinternal.cc.

References have_max_part, and termfreqs.

Referenced by RemoteSubMatch::get_postlist().

◆ 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, rset_size, termfreqs, and total_length.

◆ set_bounds_from_db()

void Xapian::Weight::Internal::set_bounds_from_db ( const Xapian::Database db_)
inline

Set the "bounds" stats from Database db.

Definition at line 234 of file weightinternal.h.

References Assert, and TermFreqs::get_description().

Referenced by MultiMatch::MultiMatch().

◆ 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 217 of file weightinternal.h.

References Assert.

◆ set_query()

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

Definition at line 119 of file weightinternal.h.

References AssertEq, and sub_db().

Referenced by MultiMatch::MultiMatch().

Member Data Documentation

◆ collection_size

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

◆ db

Xapian::Database Xapian::Weight::Internal::db

Database to get the bounds on doclength and wdf from.

Definition at line 99 of file weightinternal.h.

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

◆ 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 96 of file weightinternal.h.

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

◆ query

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

The query.

Definition at line 102 of file weightinternal.h.

◆ rset_size

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

◆ termfreqs

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

Map of term frequencies and relevant term frequencies for the collection.

Definition at line 106 of file weightinternal.h.

Referenced by LeafPostList::get_termfreq_est_using_stats(), merge(), operator+=(), LeafPostList::resolve_lazy_termweight(), serialise_stats(), and unserialise_stats().

◆ total_length

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

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