xapian-core  1.4.27
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Xapian::Internal::ExpandWeight Class Referenceabstract

Class for calculating ESet term weights. More...

#include <expandweight.h>

+ Inheritance diagram for Xapian::Internal::ExpandWeight:
+ Collaboration diagram for Xapian::Internal::ExpandWeight:

Public Member Functions

 ExpandWeight (const Xapian::Database &db_, Xapian::doccount rsize_, bool use_exact_termfreq_, bool want_collection_freq_)
 Constructor. More...
 
 ExpandWeight (const Xapian::Database &db_, Xapian::doccount rsize_, bool use_exact_termfreq_, bool want_collection_freq_, double expand_k_)
 Constructor. More...
 
void collect_stats (TermList *merger, const std::string &term)
 Get the term statistics. More...
 
virtual double get_weight () const =0
 Calculate the weight. More...
 

Protected Member Functions

double get_avlen () const
 Return the average length of the database. More...
 
Xapian::doccount get_rsize () const
 Return the number of documents in the RSet. More...
 
Xapian::termcount get_collection_freq () const
 Return the collection frequency of the term. More...
 
Xapian::totallength get_collection_len () const
 Return the length of the collection. More...
 
Xapian::doccount get_dbsize () const
 Return the size of the database. More...
 

Protected Attributes

ExpandStats stats
 An ExpandStats object to accumulate statistics. More...
 

Private Attributes

const Xapian::Database db
 The combined database. More...
 
Xapian::doccount dbsize
 The number of documents in the whole database. More...
 
Xapian::doclength avlen
 Average document length in the whole database. More...
 
Xapian::doccount rsize
 The number of documents in the RSet. More...
 
Xapian::termcount collection_freq
 The collection frequency of the term. More...
 
Xapian::totallength collection_len
 The total length of the database. More...
 
bool use_exact_termfreq
 Should we calculate the exact term frequency when generating an ESet? More...
 
bool want_collection_freq
 Does the expansion scheme use collection frequency? More...
 

Detailed Description

Class for calculating ESet term weights.

Definition at line 114 of file expandweight.h.

Constructor & Destructor Documentation

◆ ExpandWeight() [1/2]

Xapian::Internal::ExpandWeight::ExpandWeight ( const Xapian::Database db_,
Xapian::doccount  rsize_,
bool  use_exact_termfreq_,
bool  want_collection_freq_ 
)
inline

Constructor.

Parameters
db_The database.
rsize_The number of documents in the RSet.
use_exact_termfreq_When expanding over a combined database, should we use the exact termfreq (if false a cheaper approximation is used).

Definition at line 157 of file expandweight.h.

◆ ExpandWeight() [2/2]

Xapian::Internal::ExpandWeight::ExpandWeight ( const Xapian::Database db_,
Xapian::doccount  rsize_,
bool  use_exact_termfreq_,
bool  want_collection_freq_,
double  expand_k_ 
)
inline

Constructor.

Parameters
db_The database.
rsize_The number of documents in the RSet.
use_exact_termfreq_When expanding over a combined database, should we use the exact termfreq (if false a cheaper approximation is used).
expand_k_The parameter for TradWeight query expansion.

Definition at line 177 of file expandweight.h.

Member Function Documentation

◆ collect_stats()

void Xapian::Internal::ExpandWeight::collect_stats ( TermList merger,
const std::string &  term 
)

Get the term statistics.

Parameters
mergerThe tree of TermList objects.
termThe current term name.

Definition at line 37 of file expandweight.cc.

References Xapian::TermIterator::Internal::accumulate_stats(), AssertEqParanoid, AssertRel, LOGCALL_VOID, LOGLINE, and LOGVALUE.

Referenced by Xapian::ESet::Internal::expand().

◆ get_avlen()

double Xapian::Internal::ExpandWeight::get_avlen ( ) const
inlineprotected

Return the average length of the database.

Definition at line 203 of file expandweight.h.

References Xapian::Internal::ExpandStats::avlen.

◆ get_collection_freq()

Xapian::termcount Xapian::Internal::ExpandWeight::get_collection_freq ( ) const
inlineprotected

Return the collection frequency of the term.

Definition at line 209 of file expandweight.h.

◆ get_collection_len()

Xapian::totallength Xapian::Internal::ExpandWeight::get_collection_len ( ) const
inlineprotected

Return the length of the collection.

Definition at line 212 of file expandweight.h.

◆ get_dbsize()

Xapian::doccount Xapian::Internal::ExpandWeight::get_dbsize ( ) const
inlineprotected

Return the size of the database.

Definition at line 215 of file expandweight.h.

References Xapian::Internal::ExpandStats::dbsize.

◆ get_rsize()

Xapian::doccount Xapian::Internal::ExpandWeight::get_rsize ( ) const
inlineprotected

Return the number of documents in the RSet.

Definition at line 206 of file expandweight.h.

◆ get_weight()

virtual double Xapian::Internal::ExpandWeight::get_weight ( ) const
pure virtual

Calculate the weight.

Implemented in Xapian::Internal::Bo1EWeight, and Xapian::Internal::TradEWeight.

Referenced by Xapian::ESet::Internal::expand().

Member Data Documentation

◆ avlen

Xapian::doclength Xapian::Internal::ExpandWeight::avlen
private

Average document length in the whole database.

Definition at line 122 of file expandweight.h.

◆ collection_freq

Xapian::termcount Xapian::Internal::ExpandWeight::collection_freq
private

The collection frequency of the term.

Definition at line 128 of file expandweight.h.

◆ collection_len

Xapian::totallength Xapian::Internal::ExpandWeight::collection_len
private

The total length of the database.

Definition at line 131 of file expandweight.h.

◆ db

const Xapian::Database Xapian::Internal::ExpandWeight::db
private

The combined database.

Definition at line 116 of file expandweight.h.

◆ dbsize

Xapian::doccount Xapian::Internal::ExpandWeight::dbsize
private

The number of documents in the whole database.

Definition at line 119 of file expandweight.h.

◆ rsize

Xapian::doccount Xapian::Internal::ExpandWeight::rsize
private

The number of documents in the RSet.

Definition at line 125 of file expandweight.h.

◆ stats

ExpandStats Xapian::Internal::ExpandWeight::stats
protected

An ExpandStats object to accumulate statistics.

Definition at line 200 of file expandweight.h.

◆ use_exact_termfreq

bool Xapian::Internal::ExpandWeight::use_exact_termfreq
private

Should we calculate the exact term frequency when generating an ESet?

This only has any effect if we're using a combined database.

If this member is true, the exact term frequency will be obtained from the Database object. If this member is false, then an approximation is used to estimate the term frequency based on the term frequencies in the sub-databases which we see while collating term statistics, and the relative sizes of the sub-databases.

Definition at line 143 of file expandweight.h.

◆ want_collection_freq

bool Xapian::Internal::ExpandWeight::want_collection_freq
private

Does the expansion scheme use collection frequency?

Definition at line 146 of file expandweight.h.


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